首页 > 解决方案 > Angular 访问图像 src 属性

问题描述

如何[src]从控制器中的函数访问图像属性?

<ion-slides pager>
      <ion-slide *ngFor="let image of uploadService.downloadURLs">
         <img [src]="image" class="slide-image" />
      </ion-slide>
    </ion-slides> 

标签: angular

解决方案


由于您已经在 component.ts 中拥有了 uploadService.downloadURLs,因此您应该可以得到它。

否则你可以做(click) = getImage(image)


推荐阅读