This is the structure of database, I have to fetch one value('UID')
.
this.af.database.object('/profile/' + this.uid).subscribe(profile => {
console.log(profile);
this.uid = profile.uid;
console.log(this.uid);
});
You can try this:
this.af.database.object('/profile/' + this.uid).subscribe(profile => {
var obj = {};
profile.forEach(item => {
obj[item["$key"]] = item["$value"];
});
console.log(obj);
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.