0
我在我的AngularJS
應用程序中遇到了[$injector:unpr]
錯誤。AngularJS注射器問題
我已經查看了錯誤爲解決問題提供的鏈接,可悲的是它沒有改變任何東西。所以我希望你們能夠看到我做錯了什麼。
首先從我的瀏覽器控制檯錯誤
Error: [$injector:unpr] http://errors.angularjs.org/1.4.7/$injector/unpr?p0=configProvider%20%3C-%20config%20%3C-%20navController
at Error (native)
at http://localhost:8080/simplanner/lib/Angular-1.4.7/angular.min.js:6:416
at http://localhost:8080/simplanner/lib/Angular-1.4.7/angular.min.js:40:409
at Object.d [as get] (http://localhost:8080/simplanner/lib/Angular-1.4.7/angular.min.js:38:394)
at http://localhost:8080/simplanner/lib/Angular-1.4.7/angular.min.js:40:483
at d (http://localhost:8080/simplanner/lib/Angular-1.4.7/angular.min.js:38:394)
at Object.e [as invoke] (http://localhost:8080/simplanner/lib/Angular-1.4.7/angular.min.js:39:161)
at P.instance (http://localhost:8080/simplanner/lib/Angular-1.4.7/angular.min.js:80:207)
at K (http://localhost:8080/simplanner/lib/Angular-1.4.7/angular.min.js:61:190)
at g (http://localhost:8080/simplanner/lib/Angular-1.4.7/angular.min.js:54:410)
(anonymous function) @ angular.min.js:107
(anonymous function) @ angular.min.js:80
n.$apply @ angular.min.js:133
(anonymous function) @ angular.min.js:20
e @ angular.min.js:39d @ angular.min.js:19
zc @ angular.min.js:20Zd @ angular.min.js:19
(anonymous function) @ angular.min.js:293
a @ angular.min.js:174Hf.c @ angular.min.js:35
然後ofcourse我的角碼
var config = {
...
};
var app = angular.module('SimPlannerApp', [
'ui.router',
'ui.bootstrap'
]);
app.filter('capitalize', function() {
...
})
.filter('datetime', function ($filter) {
...
});
app.config(function ($stateProvider, $urlRouterProvider, $locationProvider) {
var urlBase = '/' + config.IISProjectName + '/';
$stateProvider
.state('login', {
url: "/login",
templateUrl: urlBase + 'views/login.html',
controller: 'loginController'
})
.state('view', {
url: '/view/:view',
templateUrl: urlBase + 'views/view.html',
controller: 'viewController',
resolve: {
view: function ($stateParams) {
...
}
}
})
.state('404', {
url: '{path:.*}',
templateUrl: urlBase + '/views/404.html',
controller: 'errorController'
});
});
app.factory('sharedProperties', function() {
...
});
app.factory('socketService', function() {
...
});
app.controller('errorController', ['$scope', function ($scope) {
...
}]);
app.controller('loginController', ['$scope', '$location', 'socketService', 'sharedProperties', function ($scope, $location, socketService, sharedProperties) {
...
}]);
app.controller('navController', ['$scope', 'config', 'sharedProperties', function ($scope, config, sharedProperties) {
...
}]);
app.controller('viewController', ['$scope', '$state', '$interval', 'view', 'socketService', function ($scope, $state, $interval, view, socketService) {
...
}]);
謝謝^^驚人的是一雙清新的眼睛可以做什麼。我會在8分鐘內打勾這個解決方案 –
oww :) yeaah oky很高興幫助你:) cheerz –