NGX Cookie Service
An (AOT ready) Angular (4+) service for cookies. Originally based on the ng2-cookies library.
npm install ngx-cookie-service --save# oryarn add ngx-cookie-service
Add the cookie service to your
app.module.ts as a provider:
Then, import and inject it into a component:
check( name: string ): boolean;
get( name: string ): string;
set( name: string, value: string, expires?: number | Date, path?: string, domain?: string, secure?: boolean ): void;
cookieService.set 'test', 'Hello World' ;
delete( name: string, path?: string, domain?: string ): void;
deleteAll( path?: string, domain?: string ): void;
This cookie service is brought to you by 7leads GmbH. We built it for one of our apps, because the other cookie packages we found were either not designed "the Angular way" or caused trouble during AOT compilation.
Check out the GitHub page for more.