Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/23.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
Javascript 如何在angularjs 2中嵌套子路由_Javascript_Angularjs_Angular - Fatal编程技术网

Javascript 如何在angularjs 2中嵌套子路由

Javascript 如何在angularjs 2中嵌套子路由,javascript,angularjs,angular,Javascript,Angularjs,Angular,已完成两个孩子的路由,但我想显示这些孩子的嵌套路由 例如: home child1 child2 | grand child | grand child(1) 路线代码 { path: 'faqmain', component: FaqmainComponent, children: [{path: 'chi

已完成两个孩子的路由,但我想显示这些孩子的嵌套路由

例如:

home child1 child2 
               |
                grand child
                       |
                     grand child(1)      
路线代码

{
    path: 'faqmain',
    component: FaqmainComponent,
    children: [{path: 'child-one', component: ApplicationSecondComponent}]   
  }

你可以试试这样的

{ path:'', redirectTo:'home', pathMatch:'full'},

{ path:'home',component:HomeComponent},    
{ path:'parent',component: ParentComponent,
    children:[          
      { path:'',redirectTo:'child',pathMatch:'full'},
      { path:'child',component:ChildComponent, 
         children:[          
              { path:'',redirectTo:'subChild',pathMatch:'full'},
              { path:'subChild',component:SubChildComponent}
           ]
      },
 ]},

你可以试试这样的

{ path:'', redirectTo:'home', pathMatch:'full'},

{ path:'home',component:HomeComponent},    
{ path:'parent',component: ParentComponent,
    children:[          
      { path:'',redirectTo:'child',pathMatch:'full'},
      { path:'child',component:ChildComponent, 
         children:[          
              { path:'',redirectTo:'subChild',pathMatch:'full'},
              { path:'subChild',component:SubChildComponent}
           ]
      },
 ]},

检查或嗨,我更改了问题下游的相同原则<代码>子项:[{path..,子项:[{path,component}]}]等等检查或嗨,我更改了问题下游的相同原则<代码>子项:[{path..,子项:[{path,component}]}]等等