如何通过slug解决两个不同的组件?我正在为这两种情况获得第一个组件(ItemModule)。
routing.ts
const routes: Routes = [
{
path: '',
component: MainComponent
},
{
path: '',
children: [{
path: ':itemSlug',
loadChildren: '../item/item.module#ItemModule'
}],
{
path: '',
children: [{
path: ':brandSlug',
loadChildren: '../brand/brand.module#BrandModule'
}]
}];
答案 0 :(得分:0)
const routes: Routes = [{
path: '',
component: MainComponent
},
{
path: 'slug',
children: [{
path: 'itemSlug',
loadChildren: '../item/item.module#ItemModule'
},
{
path: 'brandSlug',
loadChildren: '../brand/brand.module#BrandModule'
}
]];
这将解决您的问题。