I am able to get data from the GET API in the service layer which is printed in console.log(data) of ngOnInit() in list.ts file but I am unable to populate those values in HTML. While trying to populate the data in my HTML file, it throws the following error:
Cannot find a differ supporting object '[object Object]'
Error
Here is my code:
list.ts
constructor(private http: HttpClient, private Service: service) { }
lists:list[];
ngOnInit() {
this.Service.getData()
.subscribe(
data => {
this.lists= data;
console.log(data);
});
}
list.service.ts
getData():Observable<any> {
return this.httpclient.get("http://servername:8080/api/groups", {withCredentials: true});
}
export class list{
$id: string;
Member: Member[];
Name: string;
list.html
<table class="table">
<tr>
<th>Member</th>
<th>Name</th>
</tr>
<tr *ngFor="let a of lists">
<td>{{ a.Member}}</td>
<td>{{ a.Name}}</td>
</tr>
</table>
