2017-01-18 25 views
0

完成路由兩個孩子的,但我想說明嵌套的路線爲那些孩子的如何在angularjs嵌套子路線2

例如:

home child1 child2 
       | 
       grand child 
         | 
        grand child(1)  

航線代碼

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

檢查[this](https://coryrylan.com/blog/introduction-to-angular-routing)或[this](http://blog.angular-university.io/angular2-router/) – sTx

+0

嗨。 ,我改變了這個問題 –

+0

下游'children:[{path ..,children:[{path,component}]}]''等等原理是一樣的 – sTx

回答

1

你可以試試這樣的,

{ 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} 
      ] 
     }, 
]},