我目前的情况是:
myApp.config(['$routeProvider', function ($routeProvider) { $routeProvider.when('/home', {templateUrl: 'partials/home.html', controller: 'homeCtrl'}); }
这是我的治疗.config()
方法,我如何将波纹管代码集成到我的uper代码中:
.config(function(IdleProvider, KeepaliveProvider) { IdleProvider.idle(10*60); // 10 minutes idle IdleProvider.timeout(30); // after 30 seconds idle, time the user out KeepaliveProvider.interval(5*60); // 5 minute keep-alive ping }) .run(function($rootScope) { $rootScope.$on('IdleTimeout', function() { // end their session and redirect to login }); });
我是angularJS的新手.PS thumbup这个问题鼓励我在这里提问.
就像@Pankaj所说,你可以添加ng-idle作为脚本依赖,加载模块'ngIdle'并将配置添加到你的应用程序.
var myApp = angular.module("myApp",['ngIdle']);
看看你修改过的Plunker链接:http://plnkr.co/edit/DWKdi0QsWdrO4jqlRP6l?p = preview