I have a below response from HTTP
getEmployee(id: number){
this.empservice.getEmployee(id)
.subscribe({
next:(res)=>{
this.obj = res;
},
error:(err)=>{
alert("Error getting the employee");
console.warn(err);
}
})
}
I want to iterate the response in to a HTML Table or MAT table.
<table mat-table [dataSource]="obj">
<tbody>
<tr data-ng-repeat="(key, val) in obj[0]">
<th>
{{ key }}
</th>
<td data-ng-repeat="row in obj">
{{ rowSource[key] }}
</td>
</tr>
</tbody>
</table>
Below is the response object that i get from API
{
"employeeID": 999,
"firstName": "Peter",
"lastName": "Scotch",
"phone": "8878767654",
"email": "kumar@yahoo.com",
}