All Projects → bohoffi → ngx-localstorage

bohoffi / ngx-localstorage

Licence: Apache-2.0 license
An Angular wrapper for localstorage/sessionstorage access.

Programming Languages

typescript
32286 projects
HTML
75241 projects
javascript
184084 projects - #8 most used programming language
SCSS
7915 projects

Projects that are alternatives of or similar to ngx-localstorage

ngx-malihu-scrollbar
Angular 2+ scrollbar customization using Malihu jQuery Custom Scrollbar plugin
Stars: ✭ 59 (+118.52%)
Mutual labels:  service, directive
Store.js
Cross-browser storage for all use cases, used across the web.
Stars: ✭ 13,656 (+50477.78%)
Mutual labels:  serialization, localstorage
Tinypart
TinyPart is an iOS modularization framework implemented by Ojective-C. It also supports URL-routing and inter-module communication. TinyPart是一个由Objective-C编写的面向协议的iOS模块化框架,同时它还支持URL路由和模块间通信机制。
Stars: ✭ 120 (+344.44%)
Mutual labels:  module, service
tall
Promise-based, No-dependency URL unshortner (expander) module for Node.js
Stars: ✭ 56 (+107.41%)
Mutual labels:  module, promise
ProtocolServiceKit
iOS组件通信中间件(Protocol Service),Adapter Swift/Objective-C
Stars: ✭ 139 (+414.81%)
Mutual labels:  module, service
Beehive
🐝 BeeHive is a solution for iOS Application module programs, it absorbed the Spring Framework API service concept to avoid coupling between modules.
Stars: ✭ 4,117 (+15148.15%)
Mutual labels:  module, service
Php Serialize
Use PHP's serialization methods from Ruby.
Stars: ✭ 119 (+340.74%)
Mutual labels:  serialization, sessionstorage
Jest Localstorage Mock
A module to mock window.localStorage and window.sessionStorage in Jest
Stars: ✭ 247 (+814.81%)
Mutual labels:  localstorage, sessionstorage
cache-bucket
Light Cache for nodeJs and browserJs with TTL.
Stars: ✭ 14 (-48.15%)
Mutual labels:  localstorage, sessionstorage
mst-persist
Persist and hydrate MobX-state-tree stores (in < 100 LoC)
Stars: ✭ 75 (+177.78%)
Mutual labels:  localstorage, sessionstorage
ngx-ionic-image-viewer
An Ionic 4 Angular component to view & zoom on images and photos without any additional dependencies.
Stars: ✭ 129 (+377.78%)
Mutual labels:  module, directive
local-storage-fallback
Check and use appropriate storage adapter for browser (localStorage, sessionStorage, cookies, memory)
Stars: ✭ 103 (+281.48%)
Mutual labels:  localstorage, sessionstorage
wulaphp
一个有点复杂的PHP框架!
Stars: ✭ 26 (-3.7%)
Mutual labels:  module, service
webApi-angularjs
⚓ Definitely simplifies your work with server side & organizes webApi layout to further managing.
Stars: ✭ 15 (-44.44%)
Mutual labels:  module, service
chomex
Chrome Extension Messaging Routing Kit / Promisify Chrome Messaging / LocalStorage Object Mapper
Stars: ✭ 41 (+51.85%)
Mutual labels:  promise, localstorage
Datakernel
Alternative Java platform, built from the ground up - with its own async I/O core and DI. Ultra high-performance, simple and minimalistic - redefines server-side programming, web-development and highload!
Stars: ✭ 87 (+222.22%)
Mutual labels:  serialization, promise
Brownies
🍫 Tastier cookies, local, session, and db storage in a tiny package. Includes subscribe() events for changes.
Stars: ✭ 2,386 (+8737.04%)
Mutual labels:  localstorage, sessionstorage
Awesome Web Storage
😎 Everything you need to know about Client-side Storage.
Stars: ✭ 227 (+740.74%)
Mutual labels:  localstorage, sessionstorage
Depot.js
📦 depot.js is a storage library with a simple API
Stars: ✭ 247 (+814.81%)
Mutual labels:  serialization, localstorage
vue-storage-watcher
a reactive storage plugin for vue 👀🔭
Stars: ✭ 60 (+122.22%)
Mutual labels:  localstorage, sessionstorage

npm version

All Contributors

PR-builder

ngx-localstorage

An Angular wrapper for localstorage/sessionstorage access.

Feel free to take a look at the DEMO / API.

Buy Me A Coffee

Installation

Install via npm:

npm install ngx-localstorage --save

Usage

If you want to use the ngxLocalStorage directive you have to import the module.

Import NgxLocalstorageDirectiveModule

import {BrowserModule} from '@angular/platform-browser';
import {NgModule} from '@angular/core';
import {NgxLocalstorageDirectiveModule} from 'ngx-localstorage';

@NgModule({
    imports: [
        BrowserModule,
        NgxLocalstorageDirectiveModule
    ],
    bootstrap: [AppComponent]
})
export class AppModule { }

Configuration

For configuration provide it using the NGX_LOCAL_STORAGE_CONFIG InjectionToken.

  • prefix
    • Type: string?
    • Determines the key prefix.
    • Default: undefined
  • allowNull
    • Type: boolean?
    • Determines if null | 'null' values should be stored.
    • Default: true
  • storageType
    • Type: StorageType?
    • Determines the storage type.
    • Default: 'localStorage'
  • delimiter
    • Type: string?
    • Determines the delimiter in between prefix and key.
    • Default: underscore('_')

Serialization

Default serialization

The library utilizes the JSON.stringify()/JSON.parse() mechanics to pass values (of any type) to and from localstorage per default. If you wish you can override that behaviour by injecting your own custom serializer (app wide) or pass one per stoage call.

App wide serializer

Inject your custom serializer implentation using the provided injection token:

import {BrowserModule} from '@angular/platform-browser';
import {NgModule} from '@angular/core';
import {NGX_LOCAL_STORAGE_SERIALIZER} from 'ngx-localstorage';

@NgModule({
    imports: [
        BrowserModule
    ],
    bootstrap: [AppComponent],
    providers: [
      {
        provide: NGX_LOCAL_STORAGE_SERIALIZER,
        useClass: <custom serializer implementing StorageSerializer>
      }
    ]
})
export class AppModule { }
Per call serializer

Every set()/get() call on LocalstorageService now supports to pass an optional (de)seriaizer. If none is provided the app wide (or default) one is used.

Contributors

Thanks goes to these wonderful people (emoji key):


Basti Hoffmann

💻 📖 🤔 🚧 📦 👀

Matt Lewis

🚧

Mark

🐛 💡

NewteqDeveloper

💡

Abhishek Datta

🚧

Mikael Syska

🐛

Vladimir Stempel

💻

assureclaims

💻 🎨 📖

This project follows the all-contributors specification. Contributions of any kind welcome!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].