Auto logout with Angularjs based on idle user

前端 未结 10 698
面向向阳花
面向向阳花 2020-11-30 18:07

Is it possible to determine if a user is inactive and automatically log them out after say 10 minutes of inactivity using angularjs?

I was trying to avoid using jQue

10条回答
  •  被撕碎了的回忆
    2020-11-30 18:39

    View Demo which is using angularjs and see your's browser log

    
    
    
    
    
    
    
    
    
    
    
    
    

    Below code is pure javascript version

    
        
            
         
        
    
    

    UPDATE

    I updated my solution as @Tom suggestion.

    
    
    
    
    
    
    
    
    
    
    
    

    Click here to see at Plunker for updated version

提交回复
热议问题