Is there a way to loop through the field names (not values) of a FirebaseObjectObservable snapshot?
Thank you.
this.contact = this.angularFire.database.object('contacts/' + this.contactId);
this.contact.subscribe(contactSnapshot => {
// Loop through Field Names or place then into an Array?
console.log('field name: ', contactSnapshot.fieldNames);
})
Hi @Sun3 this type of question would be better asked on StackOverflow. Github issues are usually reserved for bug reports and feature requests, and not general how-to questions.
Will do thanks. I looked at the API but could not see a way to do it and would love to see this feature.
@Sun3 You must use this only for repo issues for question please use stackoverflow,
still to give you an idea please review below:
this.contacts = af.database.list('/contacts', { preserveSnapshot: true });
this.contacts
.subscribe(snapshots => {
//let mycontacts = [];
snapshots.forEach(snapshot => {
//console.log(snapshot.key)
//console.log(snapshot.val())
}
//this.mycontacts.push(snapshot.key);
});
Most helpful comment
@Sun3 You must use this only for repo issues for question please use stackoverflow,
still to give you an idea please review below: