Sanjit Kumar Singh

Sanjit Kumar Singh

  • NA
  • 4.5k
  • 223k

How to manage a session for a website in Angular?

May 25 2018 2:25 PM
User should not be able to access any thing after session expired.

Answers (3)

3
Bryian Tan

Bryian Tan

  • 0
  • 9.7k
  • 1.6m
May 25 2018 10:58 PM
You can use the sessionStorage API. With sessionStorage, the session will be destroyed when the user close the browser/tab/window.
 
https://alligator.io/js/introduction-localstorage-sessionstorage/ 
Accepted Answer
2
Prashanth Kumar

Prashanth Kumar

  • 0
  • 270
  • 4.3k
Jun 26 2018 8:06 AM
if you want store the value in session using angular
 
$window.sessionStorage.setItem("Name","Value")
 
Destroy the session
 $window.sessionStorage.removeItem("Name")
$window.sessionStorage.clear() 
1
Sanjit Kumar Singh

Sanjit Kumar Singh

  • 0
  • 4.5k
  • 223k
May 26 2018 11:24 AM
Thank You Briyan