$scope.stay = function() {
alert("Inside Keep me In")
$scope.timed = false;
$scope.isLogStatus = true;
}
$scope.displayAlert = function() {
$scope.timed = true;
alert("inside display")
}
function idleTimer() {
var t;
$window.onmousemove = resetTimer; // catches mouse movements
$window.onmousedown = resetTimer; // catches mouse movements
$window.onclick = resetTimer; // catches mouse clicks
$window.onscroll = resetTimer;
function logout() {
$scope.displayAlert();
alert('insinde logout');
}
function reload() {
$window.location = self.location.href; //Reloads the current page
}
function resetTimer() {
alert("timer reset")
clearTimeout(t);
$timeout(function() {
alert("timout triggered");
$scope.displayAlert();
}, 9000);
}
}
idleTimer();
I have an html element above and by default if I set
$scope.timed=true;
it's working. However, when I click on "logged in" I am setting
$scope.timed=false;
and if the time exceeds 10 minutes, I'm setting
$scope.timed=true;
(which is not triggering ng-show). As a result, the show functionality is not working as expected.
This is what is happening in the controller:
$scope.stay = function() {
alert("Inside Keep me In")
$scope.timed = false;
$scope.isLogStatus = true;
}
$scope.displayAlert = function() {
$scope.timed = true;
alert("inside display")
}
function idleTimer() {
var t;
window.onmousemove = resetTimer;
window.onmousedown = resetTimer;
window.onclick = resetTimer;
window.onscroll = resetTimer;
function logout() {
$scope.displayAlert();
alert('insinde logout');
}
function reload() {
window.location = self.location.href;
}
function resetTimer() {
clearTimeout(t);
t = setTimeout(logout, 9000);
}
}
idleTimer();
// Get the topbar menu
$scope.menu = Menus.getMenu('topbar');