0

I am using ng2-cookies, and it is clear from here that expiry is expected to be a number.

I want to set expiry as browser-session session like it appears in dev-tools.

Any help?

anusreemn
  • 1,047
  • 1
  • 10
  • 24

2 Answers2

0

Just tried sending undefined as value to optional param expiry and it worked.

Cookie.set('token', user.token, undefined, '/');
anusreemn
  • 1,047
  • 1
  • 10
  • 24
0

If you want the expire to set as session, you could just send as follow:

Cookie.set('token', user.token);

And then the expiry will be set to session as default. At least, this has definitely worked with me.