@practical-angular/local-storage
TypeScript icon, indicating that this package has built-in type declarations

15.2.11-rc.1 • Public • Published

@practical-angular/local-storage

LocalStorage support for Angular.

Usage

Import LocalStorageModule to a module.

+ import { LocalStorageModule } from '@practical-angular/local-storage';

  @NgModule({
-   imports: [BrowserModule],
+   imports: [BrowserModule, LocalStorageModule],
  })

Inject the service to a component.

+ import { LocalStorageService } from '@practical-angular/local-storage';

  export class YourComponent {
-   constructor() {}
+   constructor(private localStorageService: LocalStorageService) {}
  }

Call Set / Get / Remove Clear method.

// Set item.
this.localStorageService.setItem(key, value);

// Get item
const value = this.localStorageService.getItem(key);

// Remove item
this.localStorageService.removeItem(key);

// Clear storage
this.localStorageService.clear();

Readme

Keywords

Package Sidebar

Install

npm i @practical-angular/local-storage

Weekly Downloads

4

Version

15.2.11-rc.1

License

MIT

Unpacked Size

20.4 kB

Total Files

14

Last publish

Collaborators

  • sengokyu