I am using ngx-cookie-service
for my angular5 app. any one help me to show the way to set the expire date?
I try like this:
setCookies($event){
this.cookieService.set( 'retailAppCookies', "true", 30 );
this.cookieService.set( 'expires', '2030-07-19' );
}
But not works. any one help me?
In 2021, you can add Date but it has be date instance. The following example sets cookie with 1 hour expiration
See the API documentation for more details on this.