从 angularfire2 中的 firebase 存储上传和下载 Base64 图像:^5.0.0-rc.2

Upload and Download Base64 images from firebase storage in angularfire2: ^5.0.0-rc.2

这是我在 service.ts

中所做的
import * as firebase from 'firebase/app';

getRetuarantImageformStorage(res, hotelName) {
  this.storageRef = firebase.storage().ref().child('Restaurants/' + this.emailToKey(res.email) + '/' + hotelName);
  return this.storageRef.getDownloadURL();
}

这就是我在组件中调用方法的方式

this.dataservice.getRetuarantImageformStorage("s@gmail.com", "shangri la");

我已将图片手动上传到 firebase 存储中的上述给定路径

但是我遇到了这个错误

ERROR TypeError: __WEBPACK_IMPORTED_MODULE_1_firebase_app__.storage is not a function
at handleDataService.webpackJsonp.38.handleDataService.getRetuarantImageformStorage (handleData.service.ts:105)
at Restaurants.ts:24
at Array.forEach (<anonymous>)
at SafeSubscriber._next (Restaurants.ts:23)
at SafeSubscriber.__tryOrUnsub (Subscriber.js:238)
at SafeSubscriber.next (Subscriber.js:185)
at Subscriber._next (Subscriber.js:125)
at Subscriber.next (Subscriber.js:89)
at MapSubscriber._next (map.js:83)
at MapSubscriber.Subscriber.next (Subscriber.js:89)

我已经为此搜索了明确的文档,但没有得到任何满意的答案。

我改了: 从 'firebase/app';

导入 * 作为 firebase

至: 从 'firebase' 导入 * 作为 Firebase;