![](/img/trans.png)
[英]Angular 5: child routes are not working when I have 2 router outlet in app
[英]I'm trying to have a nested router outlet in Angular 5 but its not working
在我的app.module.ts中,我有导航栏的路线
RouterModule.forRoot([
{path:'home',component:HomeComponent},
{path:'angular5',component:Angular5MainComponent},
{path:'',redirectTo:'home', pathMatch:'full'},
{path:'**', component:HomeComponent}
]),
我有路由器出口标签。 在打开这些页面之一时,我有一个带有许多选项的侧面导航栏选项。 所以我为此创建了一个名为angular5.module.ts的模块
RouterModule.forChild([
{path:'HistoryOfAngular', component: HistoryOfAngular}
])
我也有一个路由器出口标签。 但是它不起作用
像这样创建数组并仅使用
RouterModule.forRoot([
{ path: '', component: HomeComponent, pathMatch: 'full' },
{
path: '', component: RootComponent,
children: [
{ path: 'welcome', component: WelcomeComponent },
]
},
{ path: '**', redirectTo: '', pathMatch: 'full' },];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.