1. Firstly, npm install —save ngx-cookie-service —save
2. And then import CookieService in your module like import { CookieService } from ngx-cookie-service;
3. In the module providers, add CookieService
4. In your Component constructor, inject your CookieService as private cookie: CookieService
5. Set your cookie like this.cookie.set(“userid”, “12345”);
6. Get cookie, this.cookie.get(“userid”)
Hello friends in this quick video I am gonna gonna show you how to include and use cookies in angular application, it is fairly simple all you have to do is first install ngx-cookies-service.
In our angular folder which we are in the angular cookie right now so it is;
npm install --save ngx-cookie-service
Tutorial Source: Creating Cookies in Angular 6 using ngx-cookie-service