在运行时,我能够从 Chrome 开发人员选项卡网络框架视图中获取数据,但它没有显示在控制台上。显示“Hello”警报,但不显示“Inside”警报,这很奇怪。有什么办法可以解决这个问题?
在 app.module.ts 中:
import { AngularFireModule } from 'angularfire2';
//import { AngularFireDatabase, FirebaseListObservable, FirebaseObjectObservable } from 'angularfire2/database-deprecated';
import { AngularFireDatabaseModule, AngularFireDatabase } from 'angularfire2/database'
const firebaseConfig = {
apiKey: "AIzaSyClxpBtKaVlcr5n-itSoZM_WWTLBqVf-og",
authDomain: "ionic-abs-conference.firebaseapp.com",
databaseURL: "https://ionic-abs-conference.firebaseio.com",
projectId: "ionic-abs-conference",
storageBucket: "ionic-abs-conference.appspot.com",
messagingSenderId: "668567626055"
};
内部进口:[...
AngularFireModule.initializeApp(firebaseConfig),
AngularFireDatabaseModule,
在 schedule.ts
import { AngularFireDatabase } from 'angularfire2/database'
在类 SchedulePage 构造函数内部
public angFire : AngularFireDatabase
ionViewDidLoad 内部
this.getDataFire();
接着
getDataFire()
{
alert("Hello");
this.angFire.list('/speakers/0/').valueChanges().subscribe(
data=> {
//this.arrData= data;
alert("Inside");
console.log(JSON.stringify(data))
}, (err) => {
console.log(err);
}
)
}