Skip to content

RenovoSolutions/ngx-webstorage

Repository files navigation

ngx-webstorage

ngx-webstorage is a service for utilizing both local and session storage resources of a browser. ngx-webstorage was inspired by angular-2-local-storage.

Install:

npm install ngx-webstorage

In your app:

First you need to configure the service:

import { WebStorageModule } from 'ngx-webstorage';

@NgModule({
    imports: [
        WebStorageModule.withConfig({
            prefix: 'my-app',
            storageType: 'localStorage'
        })
    ],
    declarations: [
        ..
    ],
    providers: [
        ..
    ],
    bootstrap: [AppComponent]
})
export class AppModule {}

If you are using systemjs you will need to add a map to your system.config.js file:

    var map = {
	...
	'ngx-webstorage': 'node_modules/ngx-webstorage/index.js',
    ...
};

Then you can use it in a component:

import { WebStorageService } from 'ngx-webstorage';

@Component({
    // ...
})
export class SomeComponent {
    constructor (
        private webStorageService: WebStorageService
    ) {}
}

Configuration options:

import { IWebStorageServiceConfig } from 'ngx-webstorage'; for type information about the configuration object.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published