1
所以,我是新角度,我正在構建一個應用程序,將數據保存在我的瀏覽器的localStorage中。我試圖用ngStorage爲,但我得到了以下錯誤:模塊'ngStorage'不可用
Uncaught Error: [$injector:modulerr] Failed to instantiate module myApp due to:
Error: [$injector:modulerr] Failed to instantiate module myApp.funcionarios due to:
Error: [$injector:modulerr] Failed to instantiate module ngStorage due to:
Error: [$injector:nomod] 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.
http://errors.angularjs.org/1.5.11/$injector/nomod?p0=ngStorage
at http://localhost:8000/bower_components/angular/angular.js:68:12
at http://localhost:8000/bower_components/angular/angular.js:2133:17
at ensure (http://localhost:8000/bower_components/angular/angular.js:2057:38)
at module (http://localhost:8000/bower_components/angular/angular.js:2131:14)
at http://localhost:8000/bower_components/angular/angular.js:4669:22
at forEach (http://localhost:8000/bower_components/angular/angular.js:325:20)
at loadModules (http://localhost:8000/bower_components/angular/angular.js:4653:5)
at http://localhost:8000/bower_components/angular/angular.js:4670:40
at forEach (http://localhost:8000/bower_components/angular/angular.js:325:20)
at loadModules (http://localhost:8000/bower_components/angular/angular.js:4653:5)
http://errors.angularjs.org/1.5.11/ $噴油器/ modulerr?
我已經閱讀了很多foruns,並且已經處理了我可以找到的所有答案,但仍然沒有運氣。任何人都可以看到我失蹤的東西?
這是我的索引腳本:
<script src="bower_components/ngstorage/ngStorage.js"></script>
<script src="bower_components/jquery/dist/jquery.js"></script>
<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/angular-route/angular-route.js"></script>
<script src="components/version/version.js"></script>
<script src="components/version/version-directive.js"></script>
<script src="components/version/interpolate-filter.js"></script>
<script src="funcionarios/funcionarios.js"></script>
<script src="app.js"></script>
我app.js:
'use strict';
// Declare app level module which depends on views, and components
angular.module('myApp', ['myApp.funcionarios', 'ngRoute', 'ngStorage' ])
.config(['$locationProvider', '$routeProvider', function($locationProvider, $routeProvider) {
$locationProvider.hashPrefix('!');
$routeProvider.otherwise({redirectTo: '/funcionarios'});
}]);
,這是myApp.funcionarios:
'use strict';
angular.module('myApp.funcionarios', ['ngRoute', 'ngStorage'])
.config(['$routeProvider', function($routeProvider) {
$routeProvider.when('/funcionarios', {
templateUrl: 'funcionarios/funcionarios.html',
controller: 'FuncionariosCtrl'
});
}])
.controller('FuncionariosCtrl', ['$scope', '$localStorage', '$sessionStorage', function($scope, $localStorage, $sessionStorage) {
任何幫助將是非常aprecciated !謝謝
謝謝亞瑟。這解決了問題! – codeFleck