@kimaya/ngx-cookie-storage
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

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

  1. add CookieStorage into AppModule 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 {
     }
    
  2. inject CookieStorage into Component constructor

     constructor(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

Readme

Keywords

none

Package Sidebar

Install

npm i @kimaya/ngx-cookie-storage

Weekly Downloads

3

Version

1.0.4

License

none

Unpacked Size

182 kB

Total Files

24

Last publish

Collaborators

  • ganesh.kumar