繁体   English   中英

我正在尝试在Angular 5中有一个嵌套的路由器插座,但它不起作用

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM