简体   繁体   English

Angular UI Router - 嵌套路由不适用于具有嵌套状态的模板

[英]Angular UI Router - nested routes does not work on templates with nested state

Here is my code: 这是我的代码:

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

When i click on link, in ui-view appeared template and controller of parent state. 当我点击链接时,在ui-view中出现了父状态的模板和控制器。 AngularJS version is 1.2.0-rc.2 AngularJS版本是1.2.0-rc.2

A nested state will render within the ui-view element of its parent template (which, if parentless, renders within the root ui-view ). 嵌套状态将在其父模板的ui-view元素内呈现(如果无父对象,则在根ui-view内呈现)。 Make sure you read the ' Nested States & Views ' section of the docs. 请务必阅读文档的“ 嵌套状态和视图 ”部分。

Please Pay attention to parent-child naming convention! 请注意亲子命名约定!

.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