【问题标题】:angular ui-router goes to wrong state角度 ui-router 进入错误状态
【发布时间】:2016-07-17 10:43:09
【问题描述】:

我有一个包含 ui-view

的主 index.html 文件

根据 ui-router 中的状态由(部分 html 模板)填充。

在其中一个模板中,我定义了两个按钮,它们都通向不同的路线(或状态)。第一个是编辑电影列表,第二个是创建新电影。

但是每当点击第二个按钮时,我不知道为什么第二个状态的视图永远不会显示。第一状态显示而不是它。

我已经检查了控制器和模板,我没有发现任何错误

【问题讨论】:

  • 它们是嵌套的吗?确保您有第二个视图的 <ui-view /> 容器
  • 也请贴一些代码

标签: javascript angularjs angular-ui-router


【解决方案1】:

你能把你的代码添加到小提琴中吗? 我创建了如下嵌套状态并且它们正在工作:

> .state('home.userAccount', {
>         url: '/userAccount/',
>         templateUrl: 'app/userAccount/userAccount.html',
>         controller: 'userAccount',
>         controllerAs: 'account'
>       })
>       .state('home.userAccount.myProfile', {
>         url: '/userAccount/profile/',
>         templateUrl: 'app/userAccount/userProfile/userProfile.html',
>         controller: 'myProfile',
>         controllerAs: 'profile'
>       }) state('home.userAccount.mySettings', {
>         url: '/userAccount/settings/',
>         templateUrl: 'app/userAccount/settings/settings.html',
>         controller: 'settings',
>         controllerAs: 'settings'
>       });

【讨论】:

    猜你喜欢
    • 2016-01-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-05-12
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多