Reputation: 2128
Using AngularFire, if I am using a $firebaseObject
where one of the properties of the object is an array, is it possible to represent that array as a $firebaseArray
so that I can access the API and use functions such as $add
?
Upvotes: 0
Views: 136
Reputation: 28750
"yes" but probably not how you're thinking. You can just get to that childnode if you're going to want it.
var parent = $firebaseObject(firebase.database().ref().child('parent'));
var children = $firebaseArray(firebase.database().ref().child('parent').child('children'));
If you need to wait for parent to load, hook into the $loaded()
$firebaseObject(firebase.database().ref().child('parent')).$loaded().then(function(parent){
if(parent.children){
parent.children = $firebaseArray(firebase.database().ref().child('parent').child('children'));
}
});
Upvotes: 1