Hey everyone, I've been encountering a problem while trying to use angularfire2 v 5.0. I was comfortable using v 4.0 before, but now that I'm transitioning to v 5.0, I'm facing some issues.
Does anyone know how I can display real-time data from Firebase in a label or input field on Ionic 3.0? Previously, I had no trouble subscribing with v 4.0, but now I'm struggling to understand why it's not working. Even though I can see the data in console.log, it's not showing up in the template.
import { Component, ViewChild } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { AngularFireDatabase } from 'angularfire2/database';
import { Observable } from 'rxjs';
@Component({
selector: 'page-keyboard',
templateUrl: 'keyboard.html',
})
export class KeyboardPage {
userNachna: Text;
constructor(
public navCtrl: NavController,
public navParams: NavParams,
public databaseFirebase: AngularFireDatabase,
) {
}
loadDataFirebase(){
this.databaseFirebase.object('/test/').snapshotChanges()
.subscribe(action => {
console.log(action.type); <-- WORKS
console.log(action.key) <-- WORKS
console.log(action.payload.val()) <-- WORKS
this.userNachna = action.payload.val(); <-- HERE THE ERROR
});
}
This is my Ionic 3.0 template :
<ion-input type="text" #userNachna></ion-input>