Firebase 存储和 angularfire2 [英] Firebase storage and angularfire2

查看:33
本文介绍了Firebase 存储和 angularfire2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用 angular fire 2 从 Fire base storage 中获取图像.非常感谢!

How do to get the images from Fire base storage using angular fire 2. Thanks a lot!

constructor(public af: AngularFire) {
this.items = af.database.list('/message');
this.picture = af.database.list('/profile');
}

推荐答案

目前还没有与 AngularFire2 和 Firebase Storage 的官方集成.但是,使用常规 SDK 非常容易.

Right now there isn't an official integration with AngularFire2 and Firebase Storage. However, it's quite easy to use the regular SDK.

@Component({

})
class MyComponent {
  image: string;
  constructor() {
    const storageRef = firebase.storage().ref().child('path/image.png');
    storageRef.getDownloadURL().then(url => this.image = url);
  }
}

然后在您的模板中

<img [src]="image" />

这篇关于Firebase 存储和 angularfire2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆