'Cannot find a differ supporting object '[object Object]'. NgFor only supports binding to Iterables such as Arrays
here is code i am trying to access object of objects. template
<table class="table table-striped">
<tr *ngFor="let response of response">
<td><b>ID</b><br>{{ response.user_id }} </td>
<td><b>Name:</b> {{ response.first_name }}</td>
</tr>
</table>
Solution 1:[1]
The response isn't directly an array. It is an object with properties that contain the array. From the image you posted, you could try the following
<table class="table table-striped">
<tr *ngFor="let customer of response._embedded.customers"> <!-- access properties here -->
<td>
<b>ID</b><br>
{{ customer.user_id }}
</td>
<td>
<b>Name:</b> {{ customer.first_name }}
</td>
</tr>
</table>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | ruth |