In case of user login I want to save the user data in cookies so that I can use that when the browser is closed and again open the website. For adding cookies I am using angular-cookies.js which given by angular. (https://docs.angularjs.org/api/ngCookies)
angular.module("app", ['ngCookies']);
(This is added)
app.controller("xyzController", function ($cookieStore) {});
(cookies is added into the controller)
Inside the function when I am storing the cookies I am using this code:
var expireDate = new Date();
expireDate.setDate(expireDate.getDate() + 10);
$cookies.put('data-login-user',JSON.stringify($scope.loginuser),{'expires': expireDate});
In this case the cookies is adding but it is going to session cookies. There is no expire time but according to the code I am passing 10days expire time which is not setting up in cookies.
So how can i add expire time to cookies by using this library?
The red mark cookies are the cookies which is pushed by this code by its going to session cookies