localStorageServiceProvider

localStorageServiceProvider

我的角度代码最小化后出现了问题,例如$ injector:modulerr等。
我正在使用自定义模块,请在此处https://github.com/grevory/angular-local-storage/blob/master/src/angular-local-storage.js进行查看,该模块是通过这种方式注入的:

var app = angular.module('MyNewApp', ['LocalStorageModule'] );

app.config(function(localStorageServiceProvider){
  localStorageServiceProvider.setPrefix('myNewApp');
  localStorageServiceProvider.setStorageType('sessionStorage');
})


缩小后无法使用,因此我正在尝试以下解决方法:

app.config(["localStorageService", function(localStorageServiceProvider){
  ..
})




angular.module('MyNewApp', [] )
// and also .module('LazyDogzApp', ['LocalStorageModule'] )
   .config(['localStorageService', function(localStorageServiceProvider)
   ...
   }]);


但我总是收到错误$ injector:unpr未知提供程序:localStorageService

任何想法?谢谢

最佳答案

尝试这个。

app.config(["localStorageServiceProvider", function(localStorageServiceProvider){
   ...
})

10-05 21:55