The ng-idle is used to decrease the burden, bandwidth, and workload of an app, website, program, or software. With the help of ng-idle log out the session of inactive users so that our precious data & the workload is getting preserved or to even taunt them to participate in more actively.
The ng-idle is the module, which is required to respond to and handle the idle users in the module. The ng-idle directive displays a warning dialog by using the $uibModal from UI Bootstrap. It will do the countdown for the remaining time until the session gets timed-out. The application will be sending a request to the HTTP, which is going to be ending our or any user’s current session, send the error message and finally re-direct them to the initial login page/panel. So we have learned that the main objective of the ng-idle directive module is to detect those users, who are inactive, sluggish, or simply idle. But it has another job to do. It could also be implemented to notify, alert, and warn the users of an approaching time-out.
The core of this module is the service of Idle, which it excels at doing and is best at. This is totally based upon the user’s configuration and to be aware of the activeness of the user and to then detect whether the user is active or inactive, and then finally getting the information passed onto the main application so that it could make an appropriate response.
Note: AngularJS 1.2 or later is required. This is the only dependency required.
Syntax: This syntax will be included in the module as the dependency to complete the angular configuration.
var myApp = angular.module("myApp", ['ngIdle']);
Let’s see the usage of ng-idle with an example.
- What is the use of a double-click event in AngularJs?
- How to use filter within controllers in AngularJS ?
- Why do we use $rootScope.$broadcast in AngularJS?
- How to use AngularJS to Display HTML content value ?
- How to use *ngIf else in AngularJS ?
- AngularJS | ng-show Directive
- Difference between Bootstrap and AngularJS
- AngularJS | currency Filter
- Introduction to AngularJS
- AngularJS | Factory Method
- AngularJS | ng-init Directive
- AngularJS | ng-if Directive
- AngularJS | ng-dblclick Directive
- AngularJS | ng-keypress Directive
- AngularJS | ng-keydown Directive
- AngularJS | ng-keyup Directive
- AngularJS | ng-href Directive
- AngularJS | ng-focus Directive
- AngularJS | ng-hide Directive
- AngularJS | ng-disabled Directive
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.