Reputation: 1481
I have a Firebase table named Orders:
{productID: xyz,
userID: abc,
quantity: 100}
There is another table Products containing product details. When showing a user's orders, I need to show some product details along with each order. How can I use $firebaseArray
for this purpose?
$firebaseArray
seems can only go with a table. Here, I'd need to query each ordered product's detail and add the detail to each order. Is the $extend
the way to go? If so, any good example would be very appreciated.
Upvotes: 0
Views: 784
Reputation: 29
Just saw this one. What you want to use is the NormalizedCollection. This way you can write your statement something like this:
var fb = new Firebase('https://<instance>.firebaseio.com');
var norm = new Firebase.util.NormalizedCollection(
fb.child('products'),
fb.child('productDetails')
);
var productsRef = $firebaseArray(norm.ref());
Upvotes: 0