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
Coming from Angular 1 and AngularFire I've been spoiled a bit with objects having direct access to the original ref and other helper functions. Before AF2 I wrote my own object but I like the Observable flow much better. Im having some issues though with relative paths and calling updates.
Consider a project and users that has the path like: /projects/<projectId>/teams/<teamId>/<userId>/favorite-colors
Ok, so first there are a lot of unknown keys that are needed to build the URL.
Let's say I want to add a favorite color to a user that's in a team. I have to get all the ID's and build the path relative to the root database.
It's already there!
In the object there is _ref that is private... If we just change it to $ref and public it'll work..
I'm modding my version making _ref public, but figured it would be an easy change and then thought there might be a reason why it wasn't included so I figured I'd ask.
The text was updated successfully, but these errors were encountered:
…observables
Makes the firebase.database.Reference used to create the observable public so that it can be used for accessing child records and paths relative to this collection/object.
This closesangular#294
* feat(FirebaseObjectObservable, FirebaseArrayObservable): Add $ref to observables
Makes the firebase.database.Reference used to create the observable public so that it can be used for accessing child records and paths relative to this collection/object.
This closes#294
* Locked zone.js to 0.6.12 per bug angular/zone.js#404, bug #468 created to address this.
Commented test units to correct `error TS2339`; bug #467 created to address this.
Coming from Angular 1 and AngularFire I've been spoiled a bit with objects having direct access to the original ref and other helper functions. Before AF2 I wrote my own object but I like the Observable flow much better. Im having some issues though with relative paths and calling updates.
Consider a project and users that has the path like:
/projects/<projectId>/teams/<teamId>/<userId>/favorite-colors
Ok, so first there are a lot of unknown keys that are needed to build the URL.
Let's say I want to add a favorite color to a user that's in a team. I have to get all the ID's and build the path relative to the root database.
If we added the $ref you could simplify and call
Otherwise you have to build the paths over and over when the ref is right there.
You could get it from the snapshot like this:
But that seems WAY verbose to me..
The best part?
It's already there!
In the object there is _ref that is private... If we just change it to $ref and public it'll work..
I'm modding my version making _ref public, but figured it would be an easy change and then thought there might be a reason why it wasn't included so I figured I'd ask.
The text was updated successfully, but these errors were encountered: