Angular 2:如何在应用程序启动时加载辅助路由

Sta*_*ica 7 typescript angular2-routing angular

我正在尝试在应用程序启动时加载辅助路由.虽然提到Victor Savkin的ng2路由器文章,这个SO问题以及关于命名路由器插座的这篇博,我没有设法让它正常工作.我还看到在github上提出了一个可能相关的问题,现在似乎已经解决了.

由于我的代码与命名的路由器出口文章非常相似,我将重用该代码.

路由配置如下:

const routes: Routes = [
  { path: '', redirectTo: 'home', pathMatch: 'full' },
  { path: 'home', component: HomeComponent },
  { path: 'speakers', component: SpeakersComponent, children: [
    { path: 'speakersList', component: SpeakersListComponent, outlet: 'list' },
    { path: ':id', component: BioComponent, outlet: 'bio' }
  ] },
];
Run Code Online (Sandbox Code Playgroud)

app.component.html包含

<div class="app-content">
  <router-outlet></router-outlet>
</div> 
Run Code Online (Sandbox Code Playgroud)

还有speakers.component.html

<router-outlet name="list"></router-outlet>
<router-outlet name="bio"></router-outlet>
Run Code Online (Sandbox Code Playgroud)

home.component.ts是一个基本组件,它允许用户通过单击按钮导航到扬声器组件:

  <button md-raised-button class="md-primary"
          [routerLink]="['/speakers', {outlets: {list: ['speakersList'], bio: ['none']}}]">
          Speakers
        </button>
Run Code Online (Sandbox Code Playgroud)

我正在尝试在应用程序启动时显示扬声器组件,即在路径的重定向内.我试图将其更改为:

const routes: Routes = [
  { path: '', redirectTo: 'speakers/speakersList', outlet: 'list', pathMatch: 'full' },
  { path: 'home', component: HomeComponent },
  { path: 'speakers', component: SpeakersComponent, children: [
    { path: 'speakersList', component: SpeakersListComponent, outlet: 'list' },
    { path: ':id', component: BioComponent, outlet: 'bio' }
  ] },
];
Run Code Online (Sandbox Code Playgroud)

但它不起作用.在不使用无组件路由的情况下,实现此目的的正确方法是什么?我想没有设法翻译默认路由中的routerlink中的内容.

谢谢 !

编辑:相关插件

编辑2:似乎是一个ng2错误.您可以参考此处的进展.

编辑3:根据Victor Savkin的说法:'问题是我们总是要求主要路线出现',即第一条儿童路线不应该有路径.一个修复即将到来.更多关于这个问题