鉴于此路由配置:
export const ROUTES: Route[] = [
{ path: '', redirectTo: 'projects', pathMatch: 'full' },
{ path: 'projects', component: ProjectsComponent,
children: [
{ path: 'projectlist', component: ProjectListComponent, outlet: 'sidemenu' }
]
}
];
致电
this.router.navigate(['projects(sidemenu:projectlist)']);
引发
error_handler.js:47 EXCEPTION:未捕获(在承诺中):错误:不能 匹配任何路线。网址细分:'项目(sidemenu%3Aprojectlist)'
答案 0 :(得分:0)
此设置有效。更清洁,但不确定是否传统。
export const ROUTES: Route[] = [
{ path: '', redirectTo: 'projects', pathMatch: 'full' },
{ path: 'projects',
children: [
{ path: '', component: ProjectsComponent },
{ path: '', component: ProjectListComponent, outlet: 'sidemenu' }
]
}
];