2016-07-27 6 views
0

、私は角度NG-アイドル動作していない、未知のプロバイダは、私のindex.htmlで

<script src="vendor/angular-idle.js"></script> 

などとapp.js

angular.module('app', [ uirouter, 
         routing, 
         angularResource, 
         localStorage, 
         home, 
         activity, 
         'chart.js', 
         'ngAnimate', 
         'rzModule', 
         'ui.bootstrap', 
         jsonService, 
         otherService, 
         customers, 
         'angularUtils.directives.dirPagination', 
         notifications, 
         'textAngular', 
         'ngSanitize', 
         'MassAutoComplete', 
         material, 
         countrySelect, 
         'ngIdle' 
         ]) 

内のファイルや設定ファイルを含める

.config(function(IdleProvider) { 
     IdleProvider.idle(5); 
     IdleProvider.timeout(5); 
    }) 
    .run(['Idle', function(Idle){ 
     // start watching when the app runs. also starts the Keepalive service by default. 
     Idle.watch(); 
    }]) 
    .controller('ctrl', function($scope) { 
     $scope.$on('IdleTimeout', function() { 
      let time = new Date(); 
      console.log('idle timeout at ', time); 
     }); 

     $scope.$on('IdleStart', function() { 
      let time = new Date(); 
      console.log('idle start at ', time); 
     }); 
    }) 

ブラウザは常に

angular.mi n.js:117Error:[$インジェクター:UNPR] http://errors.angularjs.org/1.5.6/ $インジェクター/ UNPR P0 = tProvider%20%3C-%20トン%20%3C-%20ctrl

不明プロバイダ:?tProvider < - CTRL

- <トン

答えて

0

tは、 "Ctrl"コントローラの$scopeへの参照が縮小されているようです。

あなたは縮小を使用している場合、あなたはどこにでもAngular's DI annotationを使用していることを確認する必要があります、つまり

.config(['IdleProvider', function(IdleProvider) { 
    // ... 
}]).controller('ctrl', ['$scope', function($scope) { 
    // ... 
}]) 
+0

遅れて確認して申し訳ありません。ありがとう@Phil –

関連する問題