Firebase存储和angularfire2

Lex*_*aig 2 firebase firebase-storage angularfire2

如何使用角火2从Fire基地存储中获取图像2.非常感谢!

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

Dav*_*ast 7

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

@Component({

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

然后在你的模板中

<img [src]="image" />
Run Code Online (Sandbox Code Playgroud)