There are two ways to achieve this
1) Using ng-Idle
here is the link to see demo and download that js file
var myApp = angular.module('myApp', ['ngIdle']); //inject ng-Idle in your app
myApp.config(['KeepaliveProvider', 'IdleProvider', function(KeepaliveProvider, IdleProvider) {
IdleProvider.idle(30);
IdleProvider.timeout(30);
KeepaliveProvider.interval(10);//check every 10 mins..
}]);
2) Using a bit of JQuery & Js
I think this small below template will give you desired result which is approach two.
var idleTime = 0;
$(document).ready(function () {
//Increment the idle time counter every minute.
var idleInterval = setInterval(timerIncrement, 60000); // 1 minute
//Zero the idle timer on mouse movement means some activity is going on .
$(this).mousemove(function (e) {
idleTime = 0;
});
$(this).keypress(function (e) {
idleTime = 0;
});
});
function timerIncrement() {
idleTime = idleTime + 1;
if (idleTime > 30) { // 30 minutes
//call your custom pop up to show user that he is inactive for 30 mins
window.location.reload();
}
}
Hope these approaches will give you an understanding how to achieve your result.