重定向到名为outlet的子项

时间:2018-01-31 11:56:28

标签: angular angular-router

我的Angular 5项目中有以下路由器配置:

{
    path: 'foo',
    component: FooComponent,
    children: [
        {
            path: ':barId',
            component: BarComponent,
            children: [
                {
                    path: '',
                    redirectTo: 'baz',
                    pathMatch: 'full'
                },
                {
                    path: 'baz',
                    component: BazComponent,
                    children: [
                        {
                            path: '',
                            redirectTo: '', // Need to redirect to (qux:0)
                            pathMatch: 'full'
                        },
                        {
                            path: '0',
                            outlet: 'qux',
                            component: QuxComponent
                        }
                    ]
                }
            ]
        }
    ]
}

我想要做的是配置路由器,以便当用户输入/foo/:barId/baz时,它会被重定向到/foo/:barId/baz/(qux:0)

是否可以在路由器配置中执行此操作?

0 个答案:

没有答案