Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mizne/angular-web-store
An angular module for web storage inspired by https://github.com/cipchk/angular-web-storage
https://github.com/mizne/angular-web-store
action angular-module angular2 angular4 expired notify webstorage
Last synced: 2 days ago
JSON representation
An angular module for web storage inspired by https://github.com/cipchk/angular-web-storage
- Host: GitHub
- URL: https://github.com/mizne/angular-web-store
- Owner: mizne
- Created: 2017-11-22T13:27:31.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2024-02-22T06:55:44.000Z (9 months ago)
- Last Synced: 2024-11-13T21:23:11.112Z (2 days ago)
- Topics: action, angular-module, angular2, angular4, expired, notify, webstorage
- Language: TypeScript
- Homepage:
- Size: 1.21 MB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.MD
Awesome Lists containing this project
README
# angular-web-store
## Installation
To install this library, run:
```bash
$ npm install angular-web-store --save
```## Quick Start
Import the `AngularWebStoreModule` in your module.
```typescript
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';import { AppComponent } from './app.component';
// Import your library
import { AngularWebStoreModule } from 'angular-web-store';@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
AngularWebStoreModule.forRoot()
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
```## Usage
### Using `LocalStorageService` or `SessionStorageService` service.
```typescript
import { Component } from '@angular/core'
import { LocalStorageService, SessionStorageService } from 'angular-web-store'@Component({
selector: 'demo',
templateUrl: './demo.component.html'
})
export class DemoComponent {constructor(
private local: LocalStorageService,
private session: SessionStorageService
) { }KEY = 'value';
value: any = null;set() {
this.local.set(this.KEY, { a: 1, now: +new Date }, '4s')
}remove() {
this.local.remove(this.KEY)
}get() {
this.value = this.local.get(this.KEY)
}clear() {
this.local.clear()
}
}## License
MIT © [mizne](mailto:[email protected])