Backend returns a list of dictionaries that the name of keys are different based on the request. For example, imagine the following data is returned.
users = [
{
'name':'John',
'age':'20'
},
{
'name':'Jane',
'age':'22'
}
]
If I know data related to “name” and “age” are returned, I can render them as the following:
<ng-container *ngFor="let user of users">
<tr>
<td>{{user.name}}</td>
<td>{{user.age}}</td>
</tr>
</ng-container>
But in my case, I don’t have the name of keys. So how can I render them in .html?
P.s.
I can get the list of keys as following:
for (let key in this.users[0]) {
this.columns.push(key);
}
This way I know the keys are “name” and “age” but I don’t know how to use them in .html.