Rad*_*FID 5 router-outlet angular angular-router
我有以下Angular Route配置
const appRoutes: Routes = [
{
path: '',
component: DirectoryComponent
},
{
path: 'manage/:type/:id',
component: ManageComponent,
outlet: 'manage',
children: [
{
path: '',
component: PreviewComponent,
pathMatch: 'full'
},
{
path: 'add/:elementType',
component: EditComponent,
}
]
}
];
Run Code Online (Sandbox Code Playgroud)
ManageComponent
是一个沙箱组件PreviewComponent
,EditComponent
将在其中呈现.
用户用例重定向http://localhost:4200/#/(manage:manage/bar/12762)
与预览组件匹配的用户.一切都还可以.
从PreviewComponent
当上一个按钮,用户点击,我希望做一个相对导航的EditComponent
有,当导航结束,http://localhost:4200/#/(manage:manage/bar/12762/add/foo)
我试过了
this.router.navigate([{outlets: {manage: ['add', 'foo']}}],{relativeTo: this.route});
Run Code Online (Sandbox Code Playgroud)
和
this.router.navigate([{outlets: {manage: ['add', 'foo']}}]);
Run Code Online (Sandbox Code Playgroud)
但每次,用户都被重定向到http://localhost:4200/#/add/foo
.
归档时间: |
|
查看次数: |
493 次 |
最近记录: |