如何使用 ngrx/router 的子路由器?

How to use child router using ngrx/router?

当我为 子路由器 使用已弃用的路由器时,我这样使用:

父路由器:

@Component({
  selector: 'app',
  directives: [RouterOutlet],
  template: `
    <router-outlet></router-outlet>
  `
})
@RouteConfig([
  { path: '/landing/...', name: 'Landing', component: LandingComponent }
])

子路由器:

@Component({
  selector: 'landing-component',
  directives: [RouterOutlet],
  template: `
    <router-outlet></router-outlet>      
  `
})
@RouteConfig([
  { path: '/welcome', name: 'Welcome', component: WelcomeComponent }
])
export class LandingComponent {
}

我正在尝试切换到 ngrx/router。我怎样才能正确使用 ngrx/router?

谢谢

我现在是这样使用的:

const landingRoutes: Routes = [
  { path: '/landing1', component: Landing1Component },
  { path: '/landing2', component: Landing2Component }
];

const routes: Routes = [
  { path: '/landing',
    component: LandingComponent,
    index: {
      component: WelcomeComponent
    },
    loadChildren: () => new Promise(resolve => resolve(landingRoutes))
  }
];

确保 return promiseloadChildren.

如果您想使用异步路由进行代码拆分,请查看here了解更多详情。