2017-02-12 64 views
0

爲什麼我收到此錯誤? state.js文件很簡單無法從狀態'home'解析'___'

(function() { 
    'use strict'; 

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

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

    function stateConfig($stateProvider) { 

     $stateProvider.state('concludi', { 
      parent: 'app', 
      url: '/concludi-acquisto', 
      views: { 
       '[email protected]': { 
        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 

回答

0

確保您導入states.js到您的index.html

+0

ui.router被導入到app.module.js中 – Dennis

+0

噢好吧,是的,考慮它會引發一個不同的錯誤。 uirouter腳本導入是否出現在app.module.js導入之前? –

+0

你在導入state.js嗎? –