Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ng7-storage

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ng7-storage

cookieless browser storage for angular

  • 1.1.0
  • npm
  • Socket score

Version published
Weekly downloads
11
increased by22.22%
Maintainers
1
Weekly downloads
 
Created
Source

ng-storage

A better way to store data in browser without cookies,

NB:we relies on session and data wont get cleared on refresh but tab close will clear all data

Usage

  • Run npm i ng-storage --save to add module to project
  • And Import via import { StorageModule } from 'storage'; in App Module
  • Add to imports
    imports: [
     BrowserModule,
     StorageModule
   ],
  • Then import service import { NgStorageService } from 'storage';
  • Then Initialize in constructor
    constructor(private http: HttpClient, private StorageService: NgStorageService) {
    }
    
Setting Data

Please note that we have to pass key value pairs to service , and key should be string and do not pass value as json string

this.StorageService.setData({ key: 'keyofdata', value: res })

NB: data format that accepted by setData method is

export interface dataFormat {
 key: string
 value?: any
}
Getting Data

Use getData method to retrive data, and it intake key as argument

eg:this.StorageService.getData('key_of_data')

Remove Data
  • removeData method is used remove single item based on key
  • removeAll method remove all data stored

Examples :

removeData:this.StorageService.removeData('key_of_data')

removeAllthis.StorageService.removeAll()

Browsers support

IE / Edge
IE / Edge
Firefox
Firefox
Chrome
Chrome
Vivaldi
Vivaldi
IE11, Edgelast 8 versionslast 8 versionslast 2 versions

Keywords

FAQs

Package last updated on 23 Jun 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc