短手擊潰定義UI-路由器:
{ state:'index', url:'', controller:IndexController, templateUrl:'/index.html' },
{ state:'index.child', url:'/child', controller:ChildController, template:'<p>Child state</p>' }
/index.html
<div ui-view>some content<a ui-sref='index.child'>go to child</a></div>
當用戶點擊的鏈接通過 - UI視圖打開/關閉標籤之間的所有HTML contnent更改爲子狀態的內容
所有我想要的,代表了角2名兒童相同的邏輯路線
爲angular2我的路由器定義:
{ path:'', component: IndexComponent, children:[ { path:'child', component:ChildComponent } ] }
IndexComponent
@Component({ selector: 'index', templateUrl: './index.component.html', styleUrls: ['./index.component.css'] })
index.component.html
<router-outlet>
<div>some content</div>
</router-outlet>
ChildComponent
@Component({ selector: 'child', template: '<div>child state</div>', styleUrls: ['./index.component.css'] })
當路由器鏈接點擊 - 我得到這個結果:
<router-outlet>
<div>some content</div><div>child state</div>
</router-outlet>
但我想下一個結果:
<router-outlet>
<div>child state</div>
</router-outlet>
路由器出口didnt更換內容UI路由器沒有,也可以通過使沒有嵌套狀態治癒,但由於某些原因,我想在嵌套狀態此功能。任何建議?嵌套狀態<ui-view>之間邏輯和差 - UI-路由器和<路由器出口> - 路由器模塊指令在angularjs
0
A
回答
1
使用這樣的事情應該工作:
{
path:'',
component: IndexComponent,
children:[
{
path: '',
component:DefaultChildComponent
},
{
path:'child',
component:ChildComponent
}
]
}
凡DefaultChildComponent
將有<div>some content</div>
作爲它的模板。
內容將永遠不會放在router-outlet中。總是在它旁邊。
相關問題
- 1. AngularJS,ui路由器,嵌套狀態
- 2. Angularjs UI路由器子模塊和URL
- 3. 反應路由器和嵌套路由
- 4. UI路由器嵌套狀態水平
- 5. ui路由器嵌套的子狀態
- 6. 嵌套狀態UI路由器
- 7. 差(「/」,路由器)和app.use(路由器)
- 8. 使用ui路由器的AngularJS路由
- 9. 在angularjs中的UI路由器動態路由和更改url
- 10. Ui路由器,ng-repeat和UI狀態
- 11. 使用UI路由器的路由問題<a>標籤
- 12. 角ui路由器ui-sref-活動和嵌套狀態
- 13. AngularJS ui路由器狀態結構
- 14. Angularjs UI路由器與累計狀態
- 15. Angularjs ui路由器狀態定義
- 16. 嵌套路線路由器
- 17. 角和UI路由器狀態孩子
- 18. 角度ui路由器嵌套視圖路由器不工作
- 19. UI路由器AngularJs嵌套狀態和嵌套的觀點正確的方法
- 20. 角UI路由器動態路由
- 21. ui路由器和多嵌套視圖/狀態?
- 22. Angular Ui路由器多個命名視圖和嵌套狀態
- 23. 角UI路由器的路由註冊
- 24. AngularJs:使用UI路由器
- 25. 角UI路由器嵌套的狀態 - 不能指定父
- 26. 模擬別名狀態UI路由器
- 27. 流星角UI-路由器路由邏輯
- 28. 退出ui路由器粘性狀態
- 29. React路由器:在動態路由刷新錯誤中嵌套靜態路由
- 30. angularjs UI路由器語法