2017-02-16 26 views
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されるだろう!ありがとう

答えて

1

ng-storageスクリプトタグを下に移動するだけです。それは角度に依存するので、それ以降にする必要があります。

<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="bower_components/ngstorage/ngStorage.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> 
+0

ありがとうございます。それは問題を解決しました! – codeFleck

関連する問題