I am currently facing a challenge in extracting a username value from my firebase database and then displaying it in a console log statement. The issue lies in fetching the child value instead of just the object. How can I retrieve the child value and print it out?
https://i.sstatic.net/EUlRV.png
getUsername.ts
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams} from 'ionic-angular';
import { AngularFireAuth } from 'angularfire2/auth';
import { AngularFireDatabase, FirebaseObjectObservable, FirebaseListObservable } from 'angularfire2/database';
@IonicPage()
@Component({
selector: 'page-profile-setup',
templateUrl: 'profile-setup.html',
})
export class ProfileSetupPage {
profileData: FirebaseObjectObservable<Profile>
constructor(private afAuth: AngularFireAuth, private afDatabase: AngularFireDatabase) {
showUsername($event) {
let data = this.profileData = this.afDatabase.object(`profile/`)
console.log(data.username);
}
}
}