无法使用Anguler 2+路由器导航/使用嵌套的子路由/插座

时间:2017-04-11 12:40:21

标签: angular

有没有人知道如何使用@ angular / router使用otherdashboard和otherdashboardsidebar outlet。这是我的路线。我想使用分层或嵌套路由,以便可以使用breadcrumbing。

export const routes: Routes = [{ path: '', redirectTo: 'login', pathMatch: 'full' },
  { path: 'login', component: LoginComponent },
  { path: 'dashboard', component: MainComponent, data:{displayName:'My App Name'},
    children: [
      { path: 'mainDashboard', component: HomeComponent, outlet: 'content', data:{displayName:'First Dashboard'},
        children:[
          { path: 'otherdashboardsidebar', component: OtherDashboardSidebarComponent, outlet: 'sidebars' },
          { path: 'otherdashboard', component: OtherDashboardComponent, outlet: 'contents',data:{displayName:'Second Dashboard'} }
        ]},
    ]
  }
];

当我使用

this.router.navigate(['/maindashboard',{outlets: {'content': ['otherdashboard'], 'sidebar': ['otherdashboardsidebar']}}]);

我得到错误:无法匹配任何路线。网址细分:' maindashboard'

0 个答案:

没有答案