1.1.5 • Published 5 years ago
ng-storages v1.1.5
ng-storages
Tested for angular5
Installation
npm install ng-storages
How to use
import { LocalStorageService } from 'ng-storages';
@NgModule({
providers: [ LocalStorageService ]
})
LocalStorage
import { LocalStorageService } from 'ng-storages';
export class AComponent {
constructor(protected storage: LocalStorageService){
this.storage.set({key: value}).then((res) => {
console.log(res);
});
this.storage.get('key').then((res) => {
console.log(res);
});
this.storage.setObject({key: object}).then((res) => {
console.log(res);
});
this.storage.getObject('key').then((res) => {
console.log(res);
});
/**
* remove specific key
*/
this.storage.delete('key').then((res) => {
console.log(res);
});
/**
* clear all storage
*/
this.storage.clear().then((res) => {
console.log(res);
});
}
}
Cookie
import { CookieService } from 'ng-storages';
@NgModule({
providers: [ CookieService ]
})
import { CookieService } from 'ng-storages';