I'm extremely new to Angular and really excited so far at how powerful it is. I'm using the angularfire2 library to retrieve two separate lists from firebase (*.ts):
this.list1= this.db.list("list1").valueChanges();
this.list2= this.db.list("list2").valueChanges();
While looping over the first list with *ngFor, I want to use list1.val as a key in obtaining a list2 value
(list2[list1.val].name).
I run into lots of different errors when trying different things, but the most prominent is this error:
TypeError: Cannot read property 'party' of undefined
This is what my *.html file looks like currently (was attempting some magic with async):
<ion-row *ngFor="let item1 of list1| async">
<ion-col>{{item1.val}}</ion-col>
<!--different attempts-->
<ion-col>{{(list2|async)[item1.val].name}}</ion-col>
<ion-col>{{(list2[item1.val].name| async)}}</ion-col>
</ion-col>
</ion-row>
I'm thinking that ngFor is somehow changing the structure of list1 from:
Observable<any[]>
to an object that's more consumable. Without that, my list2 object is actually something that cannot be indexed unless some sort of transformation happens? Help :)