ngx Cookie Storage
This project was generated with Angular CLI version 8.1.0.
How to install
npm install @kimaya/ngx-cookie-storage
How to use
-
add
CookieStorage
intoAppModule
providers
list.import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import { AppComponent } from './app.component'; import { CookieStorage } from 'ngx-cookie-storage'; @NgModule({ declarations: [ AppComponent ], imports: [ BrowserModule ], providers: [ CookieStorage ], bootstrap: [AppComponent] }) export class AppModule { }
-
inject
CookieStorage
intoComponent
constructorconstructor(private cookieStorage: CookieStorage){ }
Functions for cookie Storage
To check wheather cookie exist or not.
check(name: string): boolean;
To get value of passed cookie name
get(name: string): string;
To fetch value of cookie for object
getObject(name: string): any;
To fetch all cookies for defined domain
getAll(): {};
To set cookie and object as value
setObject(name: string, value: object | any, cookieOptions?: CookieStorageOptions): void;
To set cookie and value
set(name: string, value: string, cookieOptions?: CookieStorageOptions): void;
To delete specific cookie
delete(name: string): void;
To delete all cookies at once
deleteAll(): void;
For more Information
you can contact on kumarganesh088@gmail.com