I am new in angular5/6. Have used *ngFor with static data which works fine but table to not updating when fetching data from servers This HTML table is not getting update
{{userList | json}}--this shows []
<div class="container color-light">
<table>
<tr>
<th>Id</th>
<th>Name</th>
</tr>
<tr *ngFor="let y of userList">
<td>{{y.id}}</td>
<td>{{y.name}}</td>
</tr>
</table>
but data is received in component
userList:JsonListInterface[]=[];
ngOnInit() {
this.callingDataFromHttp();}
callingDataFromHttp(){
this.listS.getData().subscribe(function(response){
this.userList = response;
console.log(this.userList);//this shows proper array with id and name
});}
can anyone tell where i am going wrong, as frontend table is empty even after getting data.