I have an Angular2 application which is getting Json data and displaying it as a table. When I try to refresh / Update it with new data, table is showing old data only.
getting data through service like below:
@Input()
participants:Participant[]; 
testClasses: TestClass[] = []; 
ngOnChanges() {  
   let codes="";
   for (let item of this.participants)
   {
      codes = codes.concat(item.Id).concat(",");
   }   
   this.buildTable(codes);
}
buildTable(codes){
    let url = this.serverUrl + "api/test?codes=" + codes;
    // passing input participants as parameter in url
    this.testService.getData(url)
      .subscribe(data => this.onDataUpdate(data));
}
onDataUpdate(data: any) {
    this.testClasses = data;     
    // here I am getting new/refreshed data.
}
displying in table like below:
<table id="testGrid">
  <tr *ngFor="let testClass of testClasses">
    <td>{{testClass.name}}</td>
    <td *ngFor="let t of (testClass.Score)">
       {{ t }}
    </td>
  </tr>
</table>
When page loads data first time, table is showing data, but when I try to refresh data, I can see new refreshed data in onDataUpdate funcion, but html table is not refreshing view with new data.
Any idea or help would be much appreciated.
I tried below link:
 
     
    