Я пишу свое приложение angular2.
У меня есть сервис, который извлекает данные из базы данных и dashboard.component.html, который использует сервис для отображения извлеченных данных.
MYSERVICE:
detailedInfo(rownum:number){
const url='/project/users';
return this.http.get(`${url}/${rownum}`).pipe(map((data:any)=>data));
}
dashboard.component.ts:
resultDetails:any[]=[];
checkInformation(rownum:number) {
console.log("Details are called");
this.myService.detailedInfo(rownum).subscribe(
data=> {
console.log("we got:",data);
this.resultDetails=data;
console.log("length of details:"+this.resultDetails.length);
},
error => {
console.log("Error",error);
}
);
}
dashboard.component.html:
<i (click)="checkInformation(somenumber)"></i>
<table>
<tr *ngFor="let res of resultDetails">
<td >result
<p>any text</p>
</td>
<td>{{res.rownumber}}</td>
</tr>
</table>
console.log
печатает правильный результат, но ничего не отображает. Как я могу решить проблему? заранее спасибо.