I can store information using $cookieStore but it doesn't persist. When I close the browser and go to the page again there isn't any information stored.
$scope.cookieTitles;
$scope.getCookie = function () {
$scope.cookieTitles = $cookieStore.titles;
}
$scope.setCookie = function () {
$cookieStore.titles = $scope.titles;
}
As I said, when the browser is closed and reopened the $cookieStore.titles is empty.
It would be great to know how to persist information.
Thanks
J
On Tuesday, 24 July 2012 05:36:38 UTC+1, Johan wrote:
I think the description of each in the documentation makes it quite clear:
$cookie just gives you access to cookies same as if you did by some other method.
$cookieStore uses cookies to make a key/value storage solution for you.
So if you are starting something new and want to persist key/value pairs use $cookieStore
If you want to use existing cookie solution - say read/write cookies from your existing server session system then use $cookie.
On Saturday, July 21, 2012 11:35:22 AM UTC+12, Stephen Pitchford wrote:
Hi guys,
Can anyone explain with examples the difference between $cookies and $cookieStore. From looking at the source for cookies I can see that $cookieStore uses $cookies. Why use one over the other? And in fact, can $cookies be used by itself.
I am trying to work out how to manage cookies so that I can store authentication information about users in a cookie so when they try log in I can auto-login the user if their stored cookie credentials validate on the server. But since I can't seem to set the expiration time of the cookies I am not sure how to do this.
Thanks for the help,
Steve