當我使用離子來看,我的應用程序航線discover.html在啓動該調用哪個DiscoverCtrl拋出錯誤:應用程式的空檔,將引發錯誤:[NG:AREQ]
Error: [ng:areq] http://errors.angularjs.org/1.4.3/ng/areq?p0=DiscoverCtrl&p1=not%20a%20function%2C%20got%20undefined
但是當我路由到AnsweredCtrl它正確加載,並沒有問題。 此外,這隻發生在低於api level 22的版本中。當我在更高版本中運行應用程序時,它運行平穩,並且不會報錯。我無法確定它是離子問題還是構建應用程序時。我曾嘗試在config.xml中減少minSdk,但這也沒有幫助。也許我正在犯一個菜鳥的錯誤。在此先感謝您的幫助
discover.controller.js
(function() {
'use strict';
angular
.module('app.discover')
.controller('DiscoverCtrl', DiscoverCtrl);
DiscoverCtrl.$inject = ['$scope', 'ConnectivityMonitor', 'serverPath', '$stateParams', 'EndUser', '$timeout', '$compile', 'localStorageService', '$ionicHistory', 'cdnPath'];
function DiscoverCtrl($scope,ConnectivityMonitor,serverPath,$stateParams,EndUser,$timeout,$compile,localStorageService,$ionicHistory,cdnPath) {
var vm = this;
ConnectivityMonitor.startWatching();
$scope.somefunction = function(){};
}
})();
answered.controller.js
(function() {
'use strict';
angular
.module('app.answered')
.controller('AnsweredCtrl', AnsweredCtrl);
AnsweredCtrl.$inject = ['ConnectivityMonitor','serverPath','$scope','QuestionService','$timeout','$compile', 'localStorageService', 'cdnPath', 'QuestionListService'];
function AnsweredCtrl (ConnectivityMonitor,serverPath, $scope, QuestionService, $timeout, $compile, localStorageService, cdnPath, QuestionListService) {
var vm = this;
$scope.somefunction = function(){};
}
})();
app.js
angular.module('exy', [
'app.core', // contains external services
'app.discover',
'app.answered'
])
模塊定義與您指定的相同, –
您可以爲您的代碼創建一個plunkr或codepen嗎? –