In this article, In Angular 8 using pure local storage method to save the token authentication states or different app states into local storage.
Local storage is one of the Web storage property to save the states or data with no expiration date and time. You can store and access data from web storage in the browser will persist even after the browser window has been closed.
1) Install Node js
2) Install Angular & Create Angular App
Add key and value to localStorage.
const person = {
name: 'Obaseki Nosa',
location: 'Lagos',
};
localStorage.setItem('user', JSON.stringify(person));
Retrieve value by the key from localStorage.
const user = JSON.parse(localStorage.getItem('user'));
Remove an item by key from.
localStorage.removeItem('user');
Clear all localstorage data.
localStorage.clear();
1) local storage supports 5MB limit across all major browsers.
2) local storage is less secure data without protection anyone can access this data.
Thank you for watching article.
If you like please like and share to your developer friends.