我有以下路线:
const appRoutes: Routes = [
{
outlet: 'primary',
path: '',
children: [
{
path: 'briefs',
children: [
{
path: '',
outlet: 'menu',
component: BrieflistMenuComponent
},
{
path: '',
outlet: 'main',
component: BrieflistComponent
}
]
},
{
path: 'brief/:id',
children: [
{
path: '',
outlet: 'menu',
component: BriefMenuComponent
},
{
path: '',
outlet: 'main',
component: BriefComponent
}
]
},
{
path: '**',
redirectTo: '/briefs',
pathMatch: 'full'
}
]
}
];
如何在
briefs/
和brief/XXX/
使用之间导航this.router.navigate(...)
?我试过this.router.navigate(['brief', id]);
但我收到以下错误:Error: Cannot activate an already activated outlet Error: Cannot activate an already activated outlet
.如何将所有未定义的路径重定向到
briefs/
?
我使用 Angular 5。