Showing posts with label Angularjs idle timeout auto go to lock screen. Show all posts
Showing posts with label Angularjs idle timeout auto go to lock screen. Show all posts

Angularjs idle timeout auto go to lock screen

Angularjs idle timeout auto go to lock screen


Hi Guys Today discussed Angularjs idle timeout Auto go to lock screen Frontend developer very looks and pretty sides example 5 mins or 10 mins without mouse overing and not working auto go to lock screen and then enter password go to continue work.
Angularjs idle timeout auto go to lock screen
Angularjs idle timeout auto go to lock screen

Html Page

This Page index page Main Controller Config and this controller used full application working this function. follows code controller code.


Controller.js

function Appctrl($scope, $interval, $document) {
    var int = null;
    var callbacks = [];
    var idleTime = 0;
    
    $scope.isIdle = function() {
        return (idleTime > 0);
$state.go(app.lock);
    };
    
    angular.element($document).bind('mousemove', function(e) {
        idleTime = 0;
        $interval.cancel(int);
        startInterval();
        $scope.$apply();
    });
    
    function startInterval() {
        int = $interval(function() {
         idleTime += 3000;
     }, 3000);
    }
    
    startInterval();
}