[英]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.