An Angular service and decorators for easy management of localStorage and sessionStorage with reactive observables.
ngx-webstorage is an Angular library that provides services and decorators to manage localStorage and sessionStorage effortlessly. It solves the problem of manual synchronization between Angular component state and browser web storage by offering a declarative API and reactive observables for changes.
Angular developers who need persistent client-side state management across page reloads or sessions, particularly those building applications that rely on browser storage for user preferences, caching, or temporary data.
Developers choose ngx-webstorage for its seamless integration with Angular's dependency injection and decorator system, reducing boilerplate code while providing observable-based reactivity for storage changes, which is not natively available in the web storage API.
Localstorage and sessionstorage manager - Angular service
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
The @LocalStorage and @SessionStorage decorators automatically sync component properties with web storage, reducing boilerplate—as shown in examples where @LocalStorage() public boundValue; binds without explicit get/set calls.
Services provide an observe() method returning an EventEmitter, enabling reactive listening to storage changes, a feature not natively available in the web storage API.
Designed for Angular, it uses provider functions like provideNgxWebstorage() for easy setup and fits seamlessly into Angular's dependency injection system.
Via withNgxWebstorageConfig(), developers can customize prefixes, separators, and case sensitivity for storage keys, preventing conflicts in large apps as documented in the README.
The 'Known issues' section warns that object or array mutations don't trigger storage updates automatically, requiring manual reassignment like this.myArray = this.myArray; to work around it.
README documents multiple breaking changes, such as shifts from Ng2Webstorage to NgxWebstorageModule.forRoot() in v3 and to provideNgxWebstorage() in v18, complicating upgrades.
It only supports localStorage and sessionStorage, with no built-in fallbacks for larger data or encryption, restricting use cases compared to more comprehensive state management solutions.