iibtisam
iibtisam

Reputation: 177

Unable to remove cookies from angularjs with params

In AngularJs I have some issue with removing $cookies ngCookies. I'm setting cookies using subdomain i.e subdomain.example.com

Add cookie code:

$cookies.put('myCookie', true, {"path": "/", "domain":".example.com"});

Remove cookie code (which is not working)

$cookies.remove('myCookie', {"path": "/", "domain":".example.com"});

but if I remove params from cookies code then it will work fine

Add cookie code without params:

$cookies.put('myCookie1', true);

Remove cookie code without params

$cookies.remove('myCookie1');

Upvotes: 1

Views: 61

Answers (1)

Javi Zhu
Javi Zhu

Reputation: 68

$cookies.put('myCookie', true, {"path": "/", "domain":".example.com","expires":-1});

you may have a try

Upvotes: 1

Related Questions