2017-04-11 47 views
2

我正在使用ionic-framework version 2typescript無法初始化打字稿中的geofire對象

上週我整合了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, 

我希望得到任何幫助。

+0

做你找到了一個解決方案?我有同樣的問題 –

回答

0

嘗試導入Geofire這樣

import * as GeoFire from "geofire";

+0

歡迎來到stackoverflow!儘量避免回答評論,除非你有特定的答案。請使用下面的評論框,一旦你有足夠的聲譽,你將能夠評論任何帖子。 :) –