我正在开发离子版3应用程序。
我无法显示从http请求中获取的图像。我不知道为什么,为图像获取了网址,但没有显示。它仅在我转到另一页并返回时显示。
这是我的代码:
home.ts
this.myapi.request('parent_student_info',data)
.then(res =>{
this.studentsarray = []
this.studentsarray.push({
id : response.employees[i].id,
name: response.employees[i].first_name + " " + response.employees[i].last_name,
face_image: response.employees[i].face_image_small
})
home.html的
<ion-list *ngFor="let student of studentsarray" no-lines>
<ion-row padding-left>
<ion-col>
<ion-img width="70" height="70" src="{{student.face_image}}"></ion-img>
</ion-col>
<ion-col>
{{student.name}}
</ion-col>
</ion-row>
</ion-list>
如何确保图像已加载?是因为请求导致获取网址的延迟?
答案 0 :(得分:1)
我建议尝试使用普通的img标签而不是ion-img。