Firebase存储和angularfire2 [英] Firebase storage and angularfire2
本文介绍了Firebase存储和angularfire2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
构造函数(public af :AngularFire){
this.items = af.database.list('/ message');
this.picture = af.database.list('/ profile');
解决方案
与AngularFire2和Firebase Storage的正式集成。但是,使用普通的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/>
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');
}
解决方案 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);
}
}
Then in your template
<img [src]="image" />
这篇关于Firebase存储和angularfire2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文