I'm simply trying to get a username value from my firebase database and display it in a console log statement but I am having trouble doing this. This is what I have so far.
Right now all it is doing is getting the object and not the actual child value. How do I get the child value so then it can be displayed.
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);
}
}
}
