这是我在服务中所做的事情。
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)
我已经为此搜索了一份清晰的文档,但我没有得到任何满意的答案。
答案 0 :(得分:1)
我改变了: 从'firebase / app'导入*作为firebase;
以强> 从'firebase'导入*作为firebase; 的