JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q23175F
  • License MIT

angular storage tested on angular6

Package Exports

  • ng-storages

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ng-storages) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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);
        });
    }
}
import { CookieService } from 'ng-storages';
@NgModule({
  providers: [ CookieService ]
})
import { CookieService } from 'ng-storages';