【问题标题】:Could not resolve '___' from state 'home'无法从状态“家”解析“___”
【发布时间】:2017-02-13 04:23:05
【问题描述】:

为什么我会收到此错误? state.js 文件很简单

(function() {
    'use strict';

    angular
        .module('theFoodApp')
        .config(stateConfig);

    stateConfig.$inject = ['$stateProvider'];

    function stateConfig($stateProvider) {

        $stateProvider.state('concludi', {
            parent: 'app',
            url: '/concludi-acquisto',
            views: {
                'content@': {
                    templateUrl: 'app/pages/carrello/concludi-acquisto/concludi-acquisto.html',
                    controller: 'ConcludiAcquistoController',
                    controllerAs: 'vm'
                }
            }
        });
    }
})();

模板页面存在于指定路径和控制器中。 在其他页面中,我有一个带有 ui-sref="concludi" 的按钮,但是当我按下它时,我收到了这个错误

Error: Could not resolve 'concludi' from state 'home'
    at Object.transitionTo (angular-ui-router.js:3180)
    at Object.go (angular-ui-router.js:3108)
    at angular-ui-router.js:4159
    at angular.js:19612
    at completeOutstandingRequest (angular.js:5964)
    at angular.js:6243

【问题讨论】:

    标签: angularjs ui-sref


    【解决方案1】:

    确保您将states.js 导入到您的index.html

    【讨论】:

    • ui.router 在 app.module.js 中导入
    • 哦,好吧,是的,考虑一下会引发不同的错误。 uirouter 脚本导入是否出现在您的 app.module.js 导入之前?
    • 你在导入 state.js 吗?
    • 上升。我没有在我的索引中导入该文件。非常感谢马修
    • 没问题,我们终于到了。
    猜你喜欢
    • 2017-08-24
    • 1970-01-01
    • 2015-03-31
    • 2015-04-28
    • 1970-01-01
    • 2015-05-12
    • 2015-10-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多