You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This may be more a kind of general firebase question, but as it is angular specific, i wanted to ask how to handle updates in general.
Often you have small objects like:
class Meeting {
place: string;
leader: string;
}
which you then bind to an input element with ngModel. My question now: Is there a recommended way of updating the record?
Atomical updates are ideal, but imho sometimes not very useful since i think i would need a fair amount of code to get these atomic updates from the model. In the upper case i might like to update the model as a whole like
meetings.update(meeting.$key, meeting);
This leads to the following problem:
1.) The $key property is still on the meeting object and will cause an error because the key contains forbidden characters ($)
2.) If one of the properties is undefined i will get an error
1.) could be solved by deleting the $key property on update. This might not be an elegant solution, so dont worry too much about it.
My Idea would be creating a directive which binds to a FirebaseObservable and does the atomic updates, but anyhow: Is there a way to do updates in a recommended way?
The text was updated successfully, but these errors were encountered:
Right now the best option is to manually delete the $key property. In the future we'll look at supporting this in the library, but right now we are focused on getting it aligned with RC3 and supporting new Firebase features.
This may be more a kind of general firebase question, but as it is angular specific, i wanted to ask how to handle updates in general.
Often you have small objects like:
which you then bind to an input element with
ngModel
. My question now: Is there a recommended way of updating the record?Atomical updates are ideal, but imho sometimes not very useful since i think i would need a fair amount of code to get these atomic updates from the model. In the upper case i might like to update the model as a whole like
meetings.update(meeting.$key, meeting);
This leads to the following problem:
1.) The
$key
property is still on the meeting object and will cause an error because the key contains forbidden characters ($
)Now i could the following:
meetings.update(meeting.$key, { place: meeting.place, leader: meeting.leader });
2.) If one of the properties is undefined i will get an error
1.) could be solved by deleting the
$key
property on update. This might not be an elegant solution, so dont worry too much about it.My Idea would be creating a directive which binds to a
FirebaseObservable
and does the atomic updates, but anyhow: Is there a way to do updates in a recommended way?The text was updated successfully, but these errors were encountered: