I'm using ionic 3 with firebase.
Until now I use angularfire 4.0 and the following code gave me an observable for the data from firebase:
obsToData: FirebaseObjectObservable<any>;
constructor(public nav: NavController, public shared: SharedProvider,
public DB: AngularFireDatabase) {
this.obsToData = DB.object('/myData');
}
now, according to this page FirebaseObjectObservable
removed and I need to use AngularFireObject
instead, how can I get the data?
I did the following change:
obsToData: AngularFireObject<any>;
constructor(public nav: NavController, public shared: SharedProvider,
public DB: AngularFireDatabase) {
this.obsToData = DB.object('/myData');
}
but I don't find the way how to get an observable from this new object to my data from firebase.
Does someone succeed to use angularfire 5.0?
you need to use
valueChanges()
to get the Observable from the AngularFireDatabase Object reference.EDIT to get data and save it,subscribe like any observable