我是角度初学者。我正试图实现超时。如果用户空闲超过5秒钟,我会显示一个模型。当我成功注销超时时间。该对话框不断出现。我怎样才能解决这个问题。即使在超时后,“IdleStart”功能也会再次启动。 “Angular Js”
这是我的配置。
IdleProvider.idle(5);
IdleProvider.timeout(30); // after 30 seconds idle, time the user out
KeepaliveProvider.interval(5*60);
这是我的事件:
$scope.$on('IdleEnd', function() {
Idle.unwatch();
$uibModal.close();
});
$scope.$on('IdleTimeout', function() {
Idle.unwatch();
$scope.SignOut();
$uibModal.close();
});
$scope.$on('IdleStart', function() {
$scope.warning = $uibModal.open({
templateUrl: 'warning-dialog.html',
windowClass: 'modal-danger'
});
});
修订
代码我的观点:
**<script type="text/ng-template" id="warning-dialog.html">
<div class="modal-header">
<h3>You're Idle. Do Something!!!</h3>
</div>
<div idle-countdown="countdown" ng-init="countdown=5" class="modal-body">
<uib-progressbar max="5" value="5" animate="false" class="progress-striped active">You'll be logged out in {{countdown}} second(s).</uib-progressbar>
</div>
</script>**
在这个div
<div idle-countdown="countdown" ng-init="countdown=5" class="modal-body">
如果我删除idle-countdown =“倒计时”然后模型不会再出现,并注销我,但我侧杆不断显示。我无法弄清楚。
边栏包含菜单和下拉菜单,但登录了这些菜单disapperas但这种平淡侧栏不断显示只是通过删除“中止倒计时”
你能给我们一个小提琴或这个... – Sankar
它不可能导致它的很多代码。 –