1.2.1 • Published 5 months ago

@ruanitto/ngx-local-storage v1.2.1

Weekly downloads
6
License
ISC
Repository
github
Last release
5 months ago

@ruanitto/ngx-local-storage

LocalStorageService for Angular with mostly the same API (and most of the code) from angular-local-storage.

AoT compatible.

NEW Feature added

  • Addeded feature to encrypt/decrypt storage data

Differences

  • No events broadcast on $rootScope - LocalStorageService exposes observables for errors$,removeItems$, setItems$ and warning$ if you really need something to happen when something happens.
  • The bind function doesn't work anymore (there is a stub so this can still be a drop-in, but it'll do nothing).

Install

npm install @ruanitto/ngx-local-storage

Usage

You can optionally configure the module:

import { LocalStorageModule } from '@ruanitto/ngx-local-storage';

@NgModule({
    imports: [
        LocalStorageModule.forRoot({
            prefix: 'my-app',
            storageType: 'localStorage',
            encrypt: true,
            encryptKey: 'securekey'
        })
    ],
    declarations: [
        ..
    ],
    providers: [
        ..
    ],
    bootstrap: [AppComponent]
})
export class AppModule { }

Then you can use it in a component:

import { LocalStorageService } from '@ruanitto/ngx-local-storage';

@Component({
    // ...
})
export class SomeComponent {
    constructor (
        private localStorageService: LocalStorageService
    ) {
        // YAY!
    }
}

Configuration options

import { ILocalStorageServiceConfig } from '@ruanitto/ngx-local-storage'; for type information about the configuration object.

1.2.0

5 months ago

1.2.1

5 months ago

1.1.2

4 years ago

1.1.0

4 years ago

1.0.2

4 years ago

1.0.0

5 years ago