Add/Delete angular2 ng2-cookies 到路径

Add/Delete angular2 ng2-cookies to a path

如何从特定路径添加和删除ng2-cookies

要安装这个库,运行:

$ npm install ng2-cookies

用法:

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');

试试这些,以防设置到您的单个域中的 cookie 依赖于路径。