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

Share Data among multiple components in angular using browser session storage

  • 2.1.0
  • npm
  • Socket score

Version published
Weekly downloads
11
decreased by-54.17%
Maintainers
1
Weekly downloads
 
Created
Source

ng7-storage

Share Data among multiple components in angular using browser session storage

see Stackblitz Demo here More on Github

Angular compatibility

Angular Versionpackage version
angular 8 and below1.1.4 and below
angular 9 and above(ivy version)1.1.5 and above
angular 10 and above1.1.8 and above
angular 14 and above1.1.9 and above

Usage steps

  • Run npm i ng7-storage --save

  • Add to providers array in app module

   providers: [
    NgStorageService
   ],
  • Then import NgStorageService service import { NgStorageService } from 'ng7-storage'; in the components that you would like to use

  • Then Initialize NgStorageService in the component constructor

    constructor(private ngStorage: NgStorageService) {
    
    }
    

follow below methods to set and retrieve data to storage

Setting Data
this.ngStorage.setData( key: "key", value: "string|object|array", encrypt: boolean );

Pass key value pairs to store data , and key should be valid string

NB:encrypt is a development onprogress feature and may have issues when setting data that has special characters

Getting Data

eg:

  this.ngStorage.getData(key: "key", decrypt?: boolean );

Use getData method to retrieve data, pass key of the item. pass decrypt as true if you have encrypted the data

Remove Data

For removing data, we can either remove by a single key or we can remove all data at once

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

Examples :

removeData : this.ngStorage.removeData('key')

removeAll : this.ngStorage.removeAll()

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

Author 🔮

Edison
Edison Augusthy

💻

FAQs

Package last updated on 28 Apr 2024

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