I'm experiencing a challenge with displaying Firebase data in my Ionic 3 application. Below is the relevant snippet of code from my component where 'abcdef' represents a placeholder for a specific user key:
var ref = firebase.database().ref('/profiles/abcdef/');
this.viewProfile = ref.once("value")
.then(function(snapshot) {
var firstName = snapshot.child("firstName").val();
var lastName = snapshot.child("lastName").val();
var orgName = snapshot.child("orgName").val();
console.log(firstName+' '+lastName+' works at '+orgName );
});
Here's how I've tried to display it in the view:
{{viewProfile.firstName}}
Despite not encountering any errors, nothing is being displayed. Any suggestions on what might be causing this?