我有如下所示的父根
const routes: Routes = [
{
path: 'parent',
component: ParentComponent,
children: CHILD_TAB_ROUTES,
},
]
Than i have child tabs as following
export const CHILD_TAB_ROUTES: Routes = [
{ path: '', redirectTo: 'childA', pathMatch: 'full' },
{
path: 'childA',
component: ModelAComponent,
},
{
path: 'childB',
component: ModelBComponent,
},
{ path: 'childC', component: ModelCComponent },
];
所以有3条路线,例如跟随路线,当用户默认情况下单击父级时,将其呈现为childA
parent/childA
parent/childB
parent/childC
现在我想拥有一条类似的路线,我希望拥有相同的组件ModelAComponent
parent/childA/:id
[考虑到它具有不同的路线,如何使parent/childA/:id
转到ModelAComponent
?
export const CHILD_TAB_ROUTES: Routes = [
{ path: '', redirectTo: 'childA', pathMatch: 'full' },
{
path: 'childA/:id',
component: ModelAComponent,
}, {
path: 'childA',
component: ModelAComponent,
},
....
];