I am trying to set a cookie with ngx-cookie-service to be able to retrieve it later
The code is working fine when refreshing and the cookie is present in the chrome developer tools - Applications - cookies with an expiry date after a year .
when the browser is closed then opened , the cookie is not there when going to the application
My Code
import {CookieService} from 'ngx-cookie-service';
setcookie(U:User)
{
let domain = "localhost";
let path = '/';
let secure = true;
let expiry = new Date();
expiry.setDate(expiry.getDate()+365);
this.cookieService.set(
'userCookie',
JSON.stringify(U)
,expiry,path,domain,secure,'None'
);
}