【发布时间】:2018-05-10 20:11:50
【问题描述】:
我正在使用 firebase,我将图像存储在我的 firebase 存储中,然后在视图上显示这些图像,每个图像都有一个按钮,这个想法是当用户按下按钮时下载图像,我该怎么做,到目前为止,我还没有找到使用角度的方法来做到这一点,在图像对象上,我存储了downloadUrl,当我上传图像时,我想使用该 URL 来下载图像
组件
<div class="wrapper-gallery" id="photos_container">
<div class="mix col-xs-12 col-sm-4 col-md-3 item-photo" *ngFor="let photo of couplePhotos | async | sortByFavorites: sortBy | sortByTime: sortBy">
<div class="photo">
<img class="img-fluid" src="{{photo.data.photo_url}}" alt="{{photo.data.name}}">
<button class="delete" (click)="deletePhoto(photo.id, photo.data.name)"><span class="icon-cross"></span></button>
<a class="search zoom" data-fancybox="wedding" href="{{photo.data.photo_url}}"><span class="icon-search"></span></a>
<button class="star" [ngClass]="{'start-on': photo.data.favorite == true}" (click)="toggleFavorite(photo.id, photo)"><span class="icon-star-full"></span></button>
<button class="download" (click)="downloadImg()"><span class="icon-download"></span></button>
<a [href]="photo.data.photo_url" download></a>
</div>
</div>
</div>
【问题讨论】:
标签: angular firebase firebase-storage