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

标签 javascript angularjs angular-ui angular-ui-router

这是我的代码:

.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 中出现了父状态的模板和 Controller 。 AngularJS 版本为 1.2.0-rc.2

最佳答案

嵌套状态将在其父模板的 ui-view 元素内呈现(如果没有父模板,则在根 ui-view 内呈现)。请务必阅读“Nested States & Views” ' 文档部分。

关于javascript - Angular UI Router - 嵌套路由不适用于具有嵌套状态的模板,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19055367/

相关文章:

javascript - 在 JS 中将 GET 转换为 POST

javascript - Minifier混淆变量名

javascript - Angular $http 发布到 MVC 操作,参数为空

javascript - 将 angular-ui-select 与 Angular 种子项目结合使用

javascript - 在 Express 和 Node.js 中,是否可以扩展或覆盖响应对象的方法?

javascript - 无法将传统的 for 循环转换为 for-each 循环

javascript - 从 Javascript 访问 SVG 对象时收到 Uncaught SecurityError

javascript - 使用自定义名称构建面包屑

javascript - AngularJS 中的子菜单(展开/折叠树)

javascript - 将 ng-click 事件添加到 angular-ui Accordion