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

cookie less browser storage for angular

  • 1.1.3
  • npm
  • Socket score

Version published
Weekly downloads
11
decreased by-54.17%
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
  • Add import { StorageModule } from 'ng7-storage'; in App Module
  • Add to imports
    imports: [
     BrowserModule,
     StorageModule
   ],
  • Then import service import { NgStorageService } from 'ng7-storage';
  • Then Initialize in constructor
    constructor(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: 'key_of_data', value: res ,encrypt:optional|boolean})

NB: data format that accepted by setData method is

export interface dataFormat {
 key: string;
 value?: any;
 encrypt?: Boolean;
 decrypt?: Boolean;
}
Getting Data

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

eg:this.StorageService.getData({key: 'key_of_data',decrypt:optional|boolean})

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')

removeAll : this.StorageService.removeAll()

Available methods
  setData()
  getData()
  removeData()
  removeAll()

Browsers support

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

Built with 🔧

  • HTML - For the web framework
  • CSS - For styling components
  • JavaScript - For magic!
  • Angular - To add to the JavaScript magic!

Developing 👷

  1. Clone this repo with git.
  2. Install dependencies by running npm install within the directory that you cloned (probably ng-storage).
  3. Start the development server with ng serve --o.
  4. Open development site by going to http://localhost:4200 in your browser.

Author 🔮

Edison
Edison Augusthy

💻

Keywords

FAQs

Package last updated on 30 Aug 2020

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