I want to be able to do run an *ngFor on the users property of the groups object in my Firebase database.
So far, I'm trying this:
<h5>{{ (group$ | async)?.name }}</h5>
<div class="gd-users-container">
<span *ngFor="let user of (group$ | async)?.users">{{ user.email }}</span>
</div>
Where group$ = getGroup(): FirebaseObjectObservable<any>;
And the data's structure looks like this:
"groups": {
"marketing": {
"apps": {
"someid": {
"id": "someid",
"name": "Payroll"
}
},
"id": "marketing",
"name": "Marketing",
"users": {
"23948n": {
"id": "23948n",
"email": "[email protected]"
},
"asdfasdfasdf": {
"id": "asdfasdfasdf",
"email": "[email protected]"
}
}
}
}
When I try the markup above, I get the name of the group back, but I get an error when it comes to the *ngFor:
ERROR Error: Cannot find a differ supporting object '[object Object]'
of type 'object'. NgFor only supports binding to Iterables such as Arrays.
It makes sense to me why I am receiving that error, because the property users on the group object is not an array, but rather an object. My question is how to get it so that the users property can be treated as an array.