angular2의 경로에 대한 질문이 있습니다. 오늘 나는 angular2 공식 튜토리얼과 같은 예제를 사용하고 있습니다.angular2의 경로를 구성하는 가장 좋은 방법은 무엇입니까
이// app.routing.ts
import { ModuleWithProviders } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { DashboardComponent } from './dashboard.component';
import { HeroesComponent } from './heroes.component';
import { HeroDetailComponent } from './hero-detail.component';
const appRoutes: Routes = [
{
path: '',
redirectTo: '/dashboard',
pathMatch: 'full'
},
{
path: 'dashboard',
component: DashboardComponent
},
{
path: 'detail/:id',
component: HeroDetailComponent
},
{
path: 'heroes',
component: HeroesComponent
}
];
export const routing: ModuleWithProviders = RouterModule.forRoot(appRoutes);
내 질문은 : 코드는이 (file link) 같은 것입니다. 여러 개의 분지가있는 경우 엔티티 /리스트, 엔티티/추가, 엔티티/편집, 엔티티/쇼와 같은 많은 구성 요소가 있습니다.
그래서 어떻게 해결할 수 있습니까? 지저분한 구성 요소를 만들지 않고도 내 경로를 구성하는 가장 좋은 방법은 무엇입니까?
이것은 내가 찾고있는 것입니다. 이 부분은이 부분을 해결했습니다. https://angular.io/docs/ts/latest/guide/router.html#the-heroes-app-code 감사합니다. –