【发布时间】:2017-04-10 12:58:22
【问题描述】:
我是角度的初学者。我正在尝试实现超时。如果用户空闲超过 5 秒,我会显示一个模型。当我在 超时 上成功注销时。此对话框不断出现。我该如何解决这个问题。
这是我的配置。
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="countdown",则模型不会再次出现并将我注销,但我的侧边栏仍然显示。我想不通。
侧边栏包含菜单和下拉菜单,但在登录后这些菜单消失,但这个简单的侧边栏通过删除“空闲倒计时”继续显示
【问题讨论】:
-
你能给我们一个小提琴或 plunker 这个...
-
这不可能,因为它有很多代码。