2017-04-12 96 views
0

我包括這條線使用ngStorage無法注入「ngStorage」包括ngStorage文件

<script src="js/angularjs/ngStorage.min.js"></script> 

後,並注射到我的命名BookController的控制器就像我一直做

.controller('bookController', ['$scope', 'bookService', '$location', '$sessionStorage', function($scope, bookService, $location, $sessionStorage) 

爲什麼我仍然得到噴油器的錯誤也是這樣嗎?

angular.min.js:118 Error: [$injector:unpr] http://errors.angularjs.org/1.5.8/$injector/unpr?p0=<div ng-view="" class="ng-scope">essionStorageProvider%20%3C-%20%24sessionStorage%20%3C-%20bookController 
at http://localhost/cm0665/js/angularjs/angular.min.js:6:412 
at http://localhost/cm0665/js/angularjs/angular.min.js:43:174 
at Object.d [as get] (http://localhost/cm0665/js/angularjs/angular.min.js:40:432) 
at http://localhost/cm0665/js/angularjs/angular.min.js:43:236 
at d (http://localhost/cm0665/js/angularjs/angular.min.js:40:432) 
at e (http://localhost/cm0665/js/angularjs/angular.min.js:41:158) 
at Object.instantiate (http://localhost/cm0665/js/angularjs/angular.min.js:42:24) 
at http://localhost/cm0665/js/angularjs/angular.min.js:90:32 
at Object.link (http://localhost/cm0665/js/angularjs/angular-route.min.js:7:274) 
at http://localhost/cm0665/js/angularjs/angular.min.js:16:71 

您的幫助非常感謝!

+0

是否注意到了「S」從當它說,「essionStorageProvider」錯誤消息切斷? –

+1

你注入了你的模塊嗎? –

+0

@CameronRodriguez非常感謝!沒有意識到這一點。 – Danzeeeee

回答

1

您需要將ngStorage模塊注入到你的模塊。

然後你就可以在你的控制器使用$sessionStorage

+0

謝謝指出!欣賞! – Danzeeeee

+0

@Danzeeeee,歡迎您:) –