-1
我有兩條主要路由,都加載相同的子模塊。是否有任何可能的方法在子模塊上有兩個相同名稱的路線,它們針對主路線加載兩個不同的組件。Angular 2不同的模塊相同路由
主要航線:
export const ROUTES: Routes = [{
path: 'first',
loadChildren: './features/common#CommonModule',
canActivate: [AppAuthGuard]
}, {
path: 'second',
loadChildren: './features/common#CommonModule',
canActivate: [AppAuthGuard]
}]
現在我期待的通用模塊有路線是這樣的
export const routes = [{
path: 'list', component: FirstListComponent, pathMatch: 'full' }
},{
path: 'list', component: SecondListComponent, pathMatch: 'full' }
}]
所以,我想是這樣
- 如果路線是第一/列表, n FirstListComponent應該被加載。
- 如果路線是秒/列表,則SecondListComponent應該被加載。
我知道路線的順序很重要。所提議的方式是不可能的。任何人都可以提出任何可能的方法來達到這個
感謝您的答覆路徑。但是如果我這樣使用,那麼總路線將分別是* first/first/list *和* second/second/list *。 – Teja
@Teja:請參閱角色https://angular.io/guide/router#child-routing-component的路由文件。所以你會對路由有更好的想法。 – baj9032