簡體   English   中英

Angular 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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM