-
Notifications
You must be signed in to change notification settings - Fork 633
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix _parseObject()
that got broken because of angular/angular.js#6253
#320
Conversation
See discussion in angular/angular.js#6253 Wouldn't it be more direct to handle this behavior in Your comment mentions:
What do you mean by that? |
Separate but worthwhile question for @katowulf — does Firebase support There was borderline rioting in angular/angular.js#1463 from Mongo users who were sending around raw objects with $-prefixed props. |
Currently, Firebase keys can't contain any of these characters (including all $ prefixed vars): . (period) (hash or pound sign)ASCII Control Characters (0-31 and 127) |
That makes things easier then — still should use |
Hi @bendrucker, first of all - plunker that reproduces the issue: http://plnkr.co/edit/ozepSQdPvc9ItnUmnCzn?p=preview If you edit the text in the If you switch to previous angular.js version (1.3.0-beta.10) then it works just fine. |
About the http://plnkr.co/edit/Ii6PSObgC1d8W4DFV4lF?p=preview However, if you put back the |
No question this is a bug. Didn't think about the fact that dates would need be stringified. Makes sense. Would still be useful to convert the JSON serialization cycle into a manual recursive walk of the object. |
Angular's |
The 0.8 release will contain several breaking changes and this issue will probably be made obsolete (we won't be storing $ prefixes on the data or relying on angular.toJSON). It may be best to just find a workaround for now and close this out as a lot of work on a PR would be in vain. |
Would agree. Btw, guess I should have clarified that I've been referring to Ends up being a useful formatter because it takes care of both actual serialization as well as cases where you just want to grab a clean object to do whatever you want. |
I'm personally sad to see the stripping of '$' prefixed properties go away in Angular (although it makes sense, and we were all warned to not use them). I've come to enjoy being able to put local variables on a model, and have them stripped off before being persisted to Firebase or my server (via $http). With the new change, I've simply made my own JSON.stringify replacer that strips properties that have my prefix (now "A$" for me) when using the $http service. However, this won't work with angularFire. With the change to not putting $prefixes on angularFire objects, I assume that you won't be stripping any properties off the data before saving it. I'd like to suggest that there be a standard "local" data prefix that could still be used for this purpose, or that there is a configurable prefix that we can set for this purpose. Use case: storing references to a parent on a child. Another use case: storing local state. |
@joshbowdoin in 0.8 you'll be able to use your own toJSON methods or completely reformat the data before it is sent to the server. If you are interested in reviewing the upcoming API changes and offering feedback, shoot me an email at wulf at firebase and let's do a quick hangout! We'd love your feedback. |
@katowulf I would also love to learn about the upcoming API changes in 0.8.0. Any timeframe for the release? I would love to start using Angular.JS 1.3.0 in my app, and currently this issue is a blocker... Thanks! |
Being able to reformat the data before it is sent to the server sounds great! Just what I hoped for. |
Resolved for the 0.8 release. I'm going to close this out. |
The behavior of
angular.toJson()
has changed in Angular.js 1.3.0.beta-11, and it no longer strips properties starting with$
. This breaks$bind()
, since it tries to sync the$id
property of objects back to server and fails.Fixed by manually stripping everything that starts with a
$
in_parseObject()
.