1

How to add and delete ng2-cookies from a specific path?

Sagar V
  • 12,158
  • 7
  • 41
  • 68
anusreemn
  • 1,047
  • 1
  • 10
  • 24

1 Answers1

2

To install this library, run:

$ npm install ng2-cookies

Usage:

import { Cookie } from 'ng2-cookies/ng2-cookies';

Cookie.set('cookieName', 'cookieValue', 10, '/path');

let myCookie = Cookie.get('cookieName');

let cookielist = Cookie.getAll('/path');

Cookie.delete('cookieName', '/path');
Cookie.deleteAll('/path');

Try these in case the cookies set into your single domain is path dependent.

anusreemn
  • 1,047
  • 1
  • 10
  • 24
  • how can i get a special cookie. i used a ifram in my page and want to fetch its cookie, is it possible? – Me Sa Dec 08 '20 at 04:43