Reputation: 151
I have a problem with angular + firebase.
I have 2 arrays
{
"lessen" : {
"-KlL8-2To1zQ6pVdKRe2" : {
"codelink" : "",
"demolink" : "",
"publish" : 1,
"tag" : "html",
"tekst" : "",
"titel" : "HTML - elementen",
"user" : "8chFY1kE0iS2KjufzAauQ5m1IoS2"
}
},
"users" : {
"8chFY1kE0iS2KjufzAauQ5m1IoS2" : {
"displayName" : "Jur Dekker"
}
}
}
What i want its a ng-repeat on the lessen, but that he show the displayName from de user.
like this
<table>
<tr ng-repeat="lessen in lessen">
<td>{{lessen.titel}}</td>
<td>{{users.displayName (where lessen.user is equal to key from users) }}</td>
</tr>
</table>
So actually I want him to take the displayName where user of lessen array is the same as the user in users.
Upvotes: 1
Views: 88
Reputation: 136144
You can get user using its key
. Also the alias of ng-repeat
current item should be different than original collection.
<table>
<tr ng-repeat="l in lessen">
<td>{{l.titel}}</td>
<td>{{users[l.user].displayName || 'N/A'}}</td>
</tr>
</table>
Upvotes: 1