This repository has been archived by the owner on Apr 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27.5k
Saving an integer with $cookies doesn't work, and doesn't throw an error. #6151
Milestone
Comments
If I can write a failing test and fix this tonight, I think we can ship this for 1.2.13 |
I'm not sure this is the best approach. With this solution, people will see their integer value coming back as a string. Except that it will take some frantic debugging before they actually find out where that weird problem originated. I would vote for simply throwing a warning when someone tries to store an integer. 'Warning: integers can not be stored as cookies. Please convert your integer to a string'. |
Hm, I see your point. I'm not sure. What about warning and calling toString() if it's available? |
caitp
added a commit
to caitp/angular.js
that referenced
this issue
Mar 18, 2014
Previously, non-string values stored in $cookies would be removed, without warning the user, and causing difficulty debugging. Now, a warning is emitted, so that there is some idea of where the error is occurring. Closes angular#6151
caitp
added a commit
to caitp/angular.js
that referenced
this issue
Mar 18, 2014
Previously, non-string values stored in $cookies would be removed, without warning the user, and causing difficulty debugging. Now, a warning is emitted, so that there is some idea of where the error is occurring. Closes angular#6151
we should convert the value to string just like many apis do (including |
caitp
added a commit
to caitp/angular.js
that referenced
this issue
Mar 19, 2014
Previously, non-string values stored in $cookies would be removed, without warning the user, and causing difficulty debugging. Now, the value is converted to string before being stored, and the value is not dropped. Serialization may be customized using the toString() method of an object's prototype. Closes angular#6151
caitp
added a commit
to caitp/angular.js
that referenced
this issue
Mar 19, 2014
Previously, non-string values stored in $cookies would be removed, without warning the user, and causing difficulty debugging. Now, the value is converted to string before being stored, and the value is not dropped. Serialization may be customized using the toString() method of an object's prototype. Closes angular#6151
caitp
added a commit
to caitp/angular.js
that referenced
this issue
Mar 19, 2014
Previously, non-string values stored in $cookies would be removed, without warning the user, and causing difficulty debugging. Now, the value is converted to string before being stored, and the value is not dropped. Serialization may be customized using the toString() method of an object's prototype. Closes angular#6151
caitp
added a commit
that referenced
this issue
Mar 21, 2014
Previously, non-string values stored in $cookies would be removed, without warning the user, and causing difficulty debugging. Now, the value is converted to string before being stored, and the value is not dropped. Serialization may be customized using the toString() method of an object's prototype. Closes #6151 Closes #6220
tbosch
pushed a commit
to tbosch/angular.js
that referenced
this issue
Mar 21, 2014
Previously, non-string values stored in $cookies would be removed, without warning the user, and causing difficulty debugging. Now, the value is converted to string before being stored, and the value is not dropped. Serialization may be customized using the toString() method of an object's prototype. Closes angular#6151 Closes angular#6220
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Saving an integer as a cookie like so:
doesn't result in a cookie being written.
Currently, for someone who is not familiar with cookies, it takes quite some head-scratching before it becomes clear what the problem is when one cookie is written correctly but the other is not.
It would be great if trying to do this would throw an error.
The text was updated successfully, but these errors were encountered: