ngStorage in angularjs issue

2019-09-08 18:18发布

问题:

I want to use ngstorage in my project. so i install this package :

Install-Package gsklee.ngStorage

and it install successfully.then in my app i insert dependency:

  var app = angular.module("app", ['ngRoute', 'ui.bootstrap', 'ngAnimate', 'ngStorage'])
    .config(['$httpProvider', '$controllerProvider', '$routeProvider', function ($httpProvider, $controllerProvider, $routeProvider) {
        app.cp = $controllerProvider;
        $httpProvider.defaults.withCredentials = true;
    }]);

and in the page i use it like this:

<script>
  app.cp.register('userProfileController', function ($window, $localStorage) {
    function reload() {
        $localStorage.hasReloaded = true;
        $window.location.reload();
    }
    debugger;
    if (!$localStorage.hasReloaded) {
        reload();
    }
});

</script>

but it doesn't work. and it gives me this error:

Module 'ngstorage' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.

what is the problem?