2

I used AngularJS ng-idle in my application. As a result 'your session has expired' message shows on the browser tab when I moved to any other tab. I need ng-idle but don't want to show that message. How can I restrict. please helpme

app.config(['KeepaliveProvider', 'IdleProvider', function(KeepaliveProvider, IdleProvider) {
          IdleProvider.idle(25);
          IdleProvider.timeout(25);
          KeepaliveProvider.interval(50);
        }]);
Yogeshree Koyani
  • 1,649
  • 10
  • 19
Haris Aju
  • 79
  • 1
  • 6

3 Answers3

3

You must add in your title idle-disabled="true".

For example:

<title idle-disabled="true">Title</title>

Or if you want to show different message you can do it in your controller:

Title.idleMessage('Blaba {{minutes}}:{{seconds}} blablabla');
COSTADOR
  • 309
  • 2
  • 10
3

If you are using ng-idle v1.0.0 or higher there is a TitleService which includes a TitleProvider with option to disable the default enabled title changes.

So in your snipeet, just include TitleProvider.enabled(false)

app.config(['KeepaliveProvider', 'IdleProvider', 'TitleProvider', function(KeepaliveProvider, IdleProvider, TitleProvider) {
          TitleProvider.enabled(false);
          IdleProvider.idle(25);
          IdleProvider.timeout(25);
          KeepaliveProvider.interval(50);
        }]);

If you need more customization please read https://github.com/HackedByChinese/ng-idle/wiki/Title

2

The previous answer is the recommended way to do it; the 'hacky' alternative is to modify angular-idle.js, find the 'Title' factory around line 340 and comment out one statement on line 363:

  value: function(val) {
    if (angular.isUndefined(val)) return $document[0].title;

    //$document[0].title = val; --comment this out
  },
Boris
  • 1,180
  • 1
  • 18
  • 29