1

I'm using Angular v1.3.10 and i'm setting a cookie successfully. When i'm doing $cookieStore.put(key,value) and then $cookieStore.get(key) i see the object I added.

When i'm refreshing the page and doing $cookieStore.get(key) i get undefined.

Any idea why ?

Asaf Nevo
  • 11,338
  • 23
  • 79
  • 154

1 Answers1

2

At first appearance seems correct.

This works for me (version 1.3.0):

$cookieStore.put('MyVar', $scope.myVar); 
// After refresh
$scope.myVar = $cookieStore.get('MyVar');

On the other hand, you can see in documentation that $cookieStore is deprecated. You must use $cookies. It's very similar.

Good luck!

robBerto
  • 196
  • 2
  • 14