Hello,

I have 2 'tables' in FireBase:



   -  contacts <https://firelab.firebaseio.com/#>
   -  -JHE6v38rhYJsHhscDli <https://firelab.firebaseio.com/#>
      -  -JHE7DYj-Ny8wMgSAqpN <https://firelab.firebaseio.com/#>
      -  -JHi64yPwtuml5rREPrQ <https://firelab.firebaseio.com/#>
      -  address <https://firelab.firebaseio.com/#>: 
         -  city <https://firelab.firebaseio.com/#>: 
         -  name <https://firelab.firebaseio.com/#>: 
         -  telephone <https://firelab.firebaseio.com/#>: 
         -  zipcode <https://firelab.firebaseio.com/#>: 
         -  items <https://firelab.firebaseio.com/#>
   -  -JHhCIDF5yb7TSw50Ogf <https://firelab.firebaseio.com/#>
      -  contactId <https://firelab.firebaseio.com/#>: 
      


An item is linked to a contact via it's contactId field. I use AngualFire 
to retrieve the items. After retrieving the items, I want to inject each 
item with it's corresponding contact so in the view I can refer to 
item.contact.name etc

I tried this: loop through the object returned by AngularFire and inject 
each item with the contact data. But this does not work, even if I just 
change 'dataService.getContactByContactId(item.contactId)' for a hard-coded 
object {name:'Marc'}... In Batarang I can see the item object is not 
injected with a 'name' object at all.


$scope.getItems = function(){
var items = dataService.getItems();
angular.forEach(items,function(key,item){
item.contact = dataService.getContactByContactId(item.contactId);
});
$scope.items = items;
}

$scope.getItems();


Am I way off here? What's the best way to achieve this?

   - 
      - Thanks
         

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to