Id FirstName LastName Action
1. Foo Bar Edit
2. Happy Kid Edit
The json which I get from my backend is [{"id":1,"firstName":"Foo","lastName":"Bar"},{"id":2,"firstName":"Happy","lastName":"Kid"}].
Below is my HTML file -
<table datatable class="row-border hover">
<thead>
<tr>
<th>ID</th>
<th>First name</th>
<th>Last name</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<tr *ngIf="userList" >
<td *ngFor="let user of userList">{{user.firstName}}</td>
<td>
<button>Edit</button>
</td>
</tr>
</tbody>
</table>
The "userList" holds my json response.
Problem :- I get the error "Error trying to diff '[{"id":1,"firstName":"Foo","lastName":"Bar"},{"id":2,"firstName":"Happy","lastName":"Kid"}]'. Only arrays and iterables are allowed".
How do I parse my json into my required ui ?