我似乎无法在子路线之间导航。
路由器概述:
path: 'parent', component: parentComponent,
children: [
{ path: '', redirectTo: 'child1', pathMatch: 'full' },
{ path: 'child1', component: child1Component },
{ path: 'child2', component: child2Component },
{ path: 'new/:type', component: child3Component },
{ path: '**', component: PageNotFoundComponent }
]
我在child1组件中尝试导航至新/类型路由,如下所示:
this._router.navigate(['new', objType], { relativeTo: this._route });
但我一直收到错误消息:无法匹配任何路线。网址段:“新/ Assets ”。
如果我手动插入URL,它可以正常工作。
帮助将不胜感激,谢谢!
最佳答案
您可以使用../
this._router.navigate(['../new', objType], { relativeTo: this._route });
关于angular - 在子路线Angular 2之间导航,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/41396519/