ngx-json-localstorage
v1.0.0
Published
Angular 7 service for setting and getting localstorage values with JSON instead of pure strings
Downloads
4
Maintainers
Readme
NgxJsonLocalstorage
An Angular 7 implementation of JavaScript local storage that sets/gets values as JSON instead of pure strings.
Build Status
Usage
- Import
NgxJsonLocalstorageModule
into your application's module. - Import
LocalStorageService
as a dependency into your Angular component or provider - Set an item in local storage using the generic setter method, specificying the TypeScript type "T" for JSON serialization using
setItem<T>('storage-key', storageTypeScriptObject)
- Get the item using the getter method, again specifying the TypeScript type "T" for JSON deserialization using
getItem<T>('storage-key')