我正在使用 ionic-framework version 2
和 typescript
。
上周我将 Firebase 集成到我的应用中,效果很好。现在我也想集成 geofire,但我无法初始化 geofire 对象的实例。
我的 MainSearchPage 类:
import { Component, Inject } from '@angular/core';
import { AngularFire, FirebaseListObservable, FirebaseApp } from 'angularfire2';
import { GeoFire } from 'geofire';
constructor(public af: AngularFire, @Inject(FirebaseApp) firebaseApp: firebase.app.App) {
var firebaseRef = firebaseApp.database().ref();
var geofire = new GeoFire(firebaseRef);
}
但我总是得到以下错误:
Error in ./MainSearchPage class MainSearchPage_Host - caused by: WEBPACK_IMPORTED_MODULE_7_geofire.GeoFire is not a constructor
版本:
ionic-app-script 1.3.1,
typescript 2.0.6,
firebase 3.7.5,
angularfire 2.0.0-beta.8,
geofire 4.1.2,
如有任何帮助,我将不胜感激。
最佳答案
尝试像这样导入 Geofire
从“geofire”导入 * 作为 GeoFire;
关于typescript - 无法在 typescript 中初始化geofire对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43343620/