SHARE
TWEET

buatazwan3

a guest Apr 21st, 2019 87 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import { Injectable,Inject } from '@angular/core';
  2. import { LOCAL_STORAGE, StorageService } from 'ngx-webstorage-service';
  3.  
  4. const STORAGE_KEY = 'username';
  5.  
  6. @Injectable()
  7. export class LocalStorageService {
  8.   anotherTodolist = [];
  9.  
  10.   constructor(@Inject(LOCAL_STORAGE) private storage:
  11. StorageService) { }
  12.  
  13.   public storeOnLocalStorage(theCif: string): void {          
  14.     this.storage.set(STORAGE_KEY, theCif);
  15.     console.log(this.storage.get(STORAGE_KEY));
  16.   }
  17.  
  18.   public removeOnLocalStorage(){
  19.     this.storage.clear();
  20.   }
  21.  
  22.   public getOnLocalStorage(){
  23.     return this.storage.get(STORAGE_KEY);
  24.   }
  25.  
  26.  
  27. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top