Advertisement
Guest User

buatazwan3

a guest
Apr 21st, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement