离子v3无法显示来自url - ion-img的图像

时间:2018-04-07 12:19:13

标签: image rest ionic-framework ionic3

我正在开发离子版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>

如何确保图像已加载?是因为请求导致获取网址的延迟?

1 个答案:

答案 0 :(得分:1)

我建议尝试使用普通的img标签而不是ion-img。

相关问题