问题
This code in AngularJS using angular-local-storage throws an error at the console :
angular.module('myTodoApp').controller('MainCtrl', ['$scope', 'localStorageService ', function($scope, localStorageService) {
}]);
throws an error at the console :
Error: [$injector:unpr] Unknown provider: localStorageService Provider <- localStorageService <- MainCtrl http://errors.angularjs.org/1.4.7/$injector/unpr?p0=localStorageService%20Provider%20%3C-%20localStorageService%20%20%3C-%20MainCtrl at http://localhost:9000/bower_components/angular/angular.js:68:12 at 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) at http://localhost:9000/bower_components/angular/angular.js:4294:45 at getService (http://localhost:9000/bower_components/angular/angular.js:4437:39) at invoke (http://localhost:9000/bower_components/angular/angular.js:4469:13) at Object.instantiate (http://localhost:9000/bower_components/angular/angular.js:4486:27) at http://localhost:9000/bower_components/angular/angular.js:9151:28 at link (http://localhost:9000/bower_components/angular-route/angular-route.js:977:26) at invokeLinkFn (http://localhost:9000/bower_components/angular/angular.js:8789:9)
...but this runs perfectly fine!, may I know why?
angular.module('myTodoApp').controller('MainCtrl', function($scope, localStorageService) {
});
来源:https://stackoverflow.com/questions/33350071/error-in-angular-js-while-using-angular-local-storage