Why unable to stop setinterval?

Requirement is After user login, if the user is idle for 5 minutes, 3 minutes gets the popup . the pop have proceed button,if click the proceed , again extend 5 minutes, After 3 minutes , get the popup.else logout. In Ui router ,if user navigates between views, extend the time. In proceed function also extend the time. In Http request also handle the same. In below example ,click product and navigate the page. if stopsession button triggered , need to clear the session. But its not working now. Problem: If i am using Global variable as idlecheck, after second time click proceed button , the functionality is not working in correct manner, In Between 3- 5minutes, the pop up is coming and logout, but not exactly popup comes at 3 minutes. If using as local variable working as expected. But not able to clear the intervals.

To Know more code by code : stackoverflow.com/questions/43634843/why-unable-to-clear-the-setinterval-in-javascript-is-this-approach-is-wrong

See the Demo Video: http://recordit.co/xHkJeUSdp1

See the GitHub: https://github.com/MohamedSahir/UserSession

see The plunker: plnkr.co/edit/3ywUgI9362UUatExZ4FM?p=preview

Problem is not able to clear the interval .

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.