Skip to content

Web-ACAD/ng-store

Repository files navigation

NPM version Build Status

WebACAD/NgStore

Store wrapper for angular.

Dependencies

  • @angular/core
  • store

Installation

$ npm install --save @webacad/ng-store

or with yarn

$ yarn add @webacad/ng-store

Register the module

import {NgModule} from '@angular/core';
import {NgStoreModule} from '@webacad/ng-store';

@NgModule({
    imports: [
        NgStoreModule,
    ],
})
export class AppModule {}

Usage

Simply inject the NgStore service into your class:

import {NgStore} from '@webacad/ng-store';

export class AuthService
{
    
    constructor(
        private $store: NgStore,
    ) {}
    
}

Available methods:

  • get(key, default): Returns the value from store
  • set(key, value): Store a new value
  • remove(key): Remove value from the store