Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/powerbi/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular 角4中根路由器出口的嵌套路由_Angular_Nested Routes_Angular4 Router - Fatal编程技术网

Angular 角4中根路由器出口的嵌套路由

Angular 角4中根路由器出口的嵌套路由,angular,nested-routes,angular4-router,Angular,Nested Routes,Angular4 Router,我在Angular 4应用程序中使用嵌套路由。它们的结构如下: routes = [ { path: 'parent', component: ParentComponent, children: [ { path: 'child', component: ChildComponent, children: [ path: 'grandchild', compone

我在Angular 4应用程序中使用嵌套路由。它们的结构如下:

routes = [
  {
    path: 'parent',
    component: ParentComponent,
    children: [
      {
        path: 'child',
        component: ChildComponent,
        children: [
           path: 'grandchild',
           component: GrandchildComponent
        ]
      }
    ]
  }
]
我在app.component.html中定义了一个路由器出口

当我导航到“父/子”路由时,此设置工作正常,路由器出口加载子组件

但是,当我导航到“父/子/孙”路径时,孙组件不会加载

这似乎对子组件中的辅助路由器出口有效,但有没有办法让子组件加载到根路由器出口上,而不需要辅助路由器出口?

我会说没有


如果要在根插座中加载孙子,那么它不是孙子,而是祖父母!如果有嵌套管线,则需要有嵌套的出口

如果只有一个路由器出口,嵌套路由的用途是什么?必须在顶层定义路由<代码>[{path:'parent/child/granter',component:granterComponent}],但正如其他人所说,此时它不是真正的孙子,因此可能被错误标记。@DeborahK目的是使用loadChildren来延迟加载模块。在子级?那孙子们的目的呢?