![](/img/trans.png)
[英]Is there a cleaner way to use angular ui nested routes with ui-router?
[英]Angular UI Router - nested routes does not work on templates with nested state
這是我的代碼:
.state('profile',{
url : '/profile',
templateUrl: 'views/user.html',
controller: 'UserCtrl'
})
.state('profile.forgot',{
url : '/delivers',
templateUrl: 'views/user_forgot.html', <- this template not appear, when state is active
controller: 'forgotCtrl'
})
<a ui-sref="profile.forgot">Forgot your pasword?</a>
<div class="panel" ui-view=""></div>
當我點擊鏈接時,在ui-view中出現了父狀態的模板和控制器。 AngularJS版本是1.2.0-rc.2
嵌套狀態將在其父模板的ui-view
元素內呈現(如果無父對象,則在根ui-view
內呈現)。 請務必閱讀文檔的“ 嵌套狀態和視圖 ”部分。
請注意親子命名約定!
.state('profile.forgot',{
url : '/forgot',
templateUrl: 'views/profile.forgot.html',
controller: 'forgotCtrl'
})
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.