When I was working with angular cookies, I found out that only strings are accepted by $cookies and stored in browser's cookie when set. i.e
If I set the following cookies
$cookies.id = 12345;
$cookies.name = "Prasad";
Only $cookies.name is set in the browser. So I had to change it to
$cookies.id = "12345";
to make it work.
here is the fiddle link to show the demo.
I've tried to check the angular source code to see why and found that they are deliberately checking for the value to be isString.
Is there any specific reason why they are accepting only string values. Couldn't we just allow integers also and convert to string while adding to browser cookie.
Thanks!