I query the database by userkey to find if an associated object exists:
let url = ``/userMember/${userKey}``;
const userMemberRef = this.af.database.object(url, { preserveSnapshot: true });
userMemberRef.subscribe(data => {
if(data.val()!=null) {
console.log(data.val());
memberKey= data.val();
}
});
return memberKey;
It logs this in console which is good because the data I want is there.
Object {-Ke2CyV2BJ5S3_7qcQj5: true}
But how can I return the child key value "-Ke2CyV2BJ5S3_7qcQj5
"?
Seems to be very trivial. I appreciate your help!