I have below code which getting data from the firestore directly from angular. as you can look console.log(data.city); where I have document reference of city. so how could I access data from document reference in angular?
1 Answer
Document references in Firestore won't give you data right away. You'll have to use that document reference and get data from firebase.
It is just like getting data manually referencing a document. For instance,
this.afs.collection('users').doc('doc_id').get().then(result => console.log(result.data()));;//if you want to access a specific document
if you already have a reference (like city in your case),
data.city.get().then(result => console.log(result.data()));
You can use :any datatype to data object if it throws any invalid reference exception
Hope this helps!!