angular-2-local-storage
TypeScript icon, indicating that this package has built-in type declarations

3.0.2 • Public • Published

angular-2-local-storage

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

AoT compatible.

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 angular-2-local-storage

Usage

You can optionally configure the module:

import { LocalStorageModule } from 'angular-2-local-storage';
 
@NgModule({
    imports: [
        LocalStorageModule.forRoot({
            prefix: 'my-app',
            storageType: 'localStorage'
        })
    ],
    declarations: [
        ..
    ],
    providers: [
        ..
    ],
    bootstrap: [AppComponent]
})
export class AppModule { }

Then you can use it in a component:

import { LocalStorageService } from 'angular-2-local-storage';
 
@Component({
    // ...
})
export class SomeComponent {
    constructor (
        private _localStorageService: LocalStorageService
    ) {
        // YAY!
    }
}
 

Configuration options

import { ILocalStorageServiceConfig } from 'angular-2-local-storage'; for type information about the configuration object.

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
3.0.28,080latest

Version History

VersionDownloads (Last 7 Days)Published
3.0.28,080
3.0.142
3.0.02
2.0.172
2.0.0171
1.0.2385
1.0.1185
1.0.049
0.1.0-beta.00
0.0.250
0.0.240
0.0.230
0.0.220
0.0.210
0.0.200
0.0.190
0.0.180
0.0.170
0.0.160
0.0.150
0.0.140
0.0.130
0.0.120
0.0.50
0.0.40
0.0.30
0.0.20
0.0.10

Package Sidebar

Install

npm i angular-2-local-storage

Weekly Downloads

8,986

Version

3.0.2

License

MIT

Unpacked Size

204 kB

Total Files

33

Last publish

Collaborators

  • elwyn
  • elwynelwyn
  • phenomnomnominal