使用angular-local-storage的AngularJS中的代码在控制台上抛出错误:
angular.module('myTodoApp').controller('MainCtrl', ['$scope', 'localStorageService ', function($scope, localStorageService) {
}]);
在控制台抛出错误:
错误:[$ injector:unpr]未知提供者:localStorageService Provider< - localStorageService< - MainCtrl http://errors.angularjs.org/1.4.7/ $注射器/ unpr?P0 = localStorageService%20Provider%20%3 C-%20localStorageService%20%20%3 C-%20MainCtrl 在http://localhost:9000/bower_components/angular/angular.js:68:12 在http://localhost:9000/bower_components/angular/angular.js:4289:19 at Object.getService [as get](http://localhost:9000/bower_components/angular/angular.js:4437:39) 在http://localhost:9000/bower_components/angular/angular.js:4294:45 at getService(http://localhost:9000/bower_components/angular/angular.js:4437:39) 在调用(http://localhost:9000/bower_components/angular/angular.js:4469:13) 在Object.instantiate(http://localhost:9000/bower_components/angular/angular.js:4486:27) 在http://localhost:9000/bower_components/angular/angular.js:9151:28 在链接(http://localhost:9000/bower_components/angular-route/angular-route.js:977:26) 在invokeLinkFn(http://localhost:9000/bower_components/angular/angular.js:8789:9)
...但这完全没问题!我可以知道为什么吗?
angular.module('myTodoApp').controller('MainCtrl', function($scope, localStorageService) {
});