【发布时间】:2018-01-25 15:46:20
【问题描述】:
我正在使用带有 angular2 的 firebase。我厌倦了使用图像的直接 url 访问 firebase 存储桶中的图像。它给出了一些安全错误,但在地址栏中输入时可以直接在浏览器中查看相同的图像。
<img src="gs://img url in firebase storage">
然后我通过链接Angular2Fire Image access尝试了该方法。但它返回给我的是对象而不是 url 访问。
TS:
recommendedListBind(list){
list.forEach(lists => {
const storageRef = firebase.storage().ref().child(lists.thumbnail);
let thumbnail = storageRef.getDownloadURL().then(url => url);
let Detail = {
title : lists.title,
thumbnail : thumbnail,
}
this.recommendedList.push(Detail);
});
};
HTML:
<ul>
<li *ngFor="let List of recommendedList">
<div class='cards'>
<img src={{List.thumbnail}} alt={{List.title}} title={{List.title}} />
</li>
</ul>
在 Firebase 存储中访问图像的正确方法是什么?
【问题讨论】:
标签: angular firebase firebase-storage angularfire2