Armazenamento local angular
localStorage.setItem('dataSource', this.dataSource.length); // setting
console.log(localStorage.getItem('dataSource')); // getting
Ankur
localStorage.setItem('dataSource', this.dataSource.length); // setting
console.log(localStorage.getItem('dataSource')); // getting
function createItem() {
localStorage.setItem('nameOfItem', 'value');
}
createItem() // Creates a item named 'nameOfItem' and stores a value of 'value'
function getValue() {
return localStorage.getItem('nameOfItem');
} // Gets the value of 'nameOfItem' and returns it
console.log(getValue()); //'value';
localStorage.setItem('user_name', 'Rohit'); //store a key/value
var retrievedUsername = localStorage.getItem('user_name'); //retrieve the key