2017-04-12 118 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,欢迎您:) –