[英]Ionic3 ion-img do not show images with ng-for
我正在嘗試使用ion-img使用循環顯示動態圖像,但是它不起作用。
<ion-item no-lines no-padding *ngFor="let company of shortedDistanceArray">
<div>
<ion-img style="width: 15vh;height: 12vh;" src={{company.images}}"></ion-img>
</div>
</ion-item>
在這里,您需要使用property binding
,如下所示。 始終嘗試避免string interpolation
。
<ion-item no-lines no-padding *ngFor="let company of shortedDistanceArray">
<div>
<img style="width: 15vh;height: 12vh;" [src]="company.images"></img>
</div>
</ion-item>
我發現解決方案使用“ img”標簽代替“ ion-img”
<ion-item no-lines no-padding *ngFor="let company of shortedDistanceArray">
<div>
<img style="width: 15vh;height: 12vh;" src={{company.images}}" />
</div>
</ion-item>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.