我正在尝试执行以下操作
我成功地使用 router-outlet 和 app.routing-module.ts 导航到侧导航栏。我为 Nav4 组件内的选项卡尝试了辅助路由。但它失败了。谁能帮我解决这个问题?
导入所需组件后的 app.routing-module.ts
const routes: Routes = [
{ path: '', component: Nav1Component},
{ path: 'nav2', component: Nav2Component},
{ path: 'nav3', component: Nav3Component},
{
path: 'nav4', component: Nav4Component, children: [
{ path: 'tab1', component: Tab1Component, outlet: 'configureoutlet'},
{ path: 'tab2', component: Tab2Component, outlet: 'configureoutlet'}
{ path: 'tab3', component: Tab3Component, outlet: 'configureoutlet'},
{ path: 'tab4', component: Tab4Component, outlet: 'configureoutlet'},
{ path: 'tab5', component: Tab5Component, outlet: 'configureoutlet'},
]
}
];
app.component.html
<router-outlet></router-outlet>
Nav4component.html
<h4>Nav 4 general content</h4>
<ul>
<li routerlink="['/nav4', { outlets: { configureoutlet: ['tab1'] }} ]" routerLinkActive='active'>Tab 1</li>
<li routerlink="['/nav4', { outlets: { configureoutlet: ['tab2'] }} ]" routerLinkActive='active'>Tab 2</li>
<li routerlink="['/nav4', { outlets: { configureoutlet: ['tab3'] }} ]" routerLinkActive='active'>Tab 3</li>
<li routerlink="['/nav4', { outlets: { configureoutlet: ['tab4'] }} ]" routerLinkActive='active'>Tab 4</li>
<li routerlink="['/nav4', { outlets: { configureoutlet: ['tab5'] }} ]" routerLinkActive='active'>Tab 5</li>
</ul>
<router-outlet name='configureoutlet'></router-outlet>
当我运行应用程序时,出现以下错误:
错误:无法匹配任何路由