(Sorry for bad English, I am not a native speaker)
I am having problem passing values to an object, and showing it in html.
Below are my codes:
completeUserProfile = {};
async testfunction() {
const sampleArray = [1, 2];
const interestRef = this.firestore.firestore.collection('interest');
const result = interestRef.where('interestIn', 'array-contains-any', sampleArray).get();
await result.then(querySnapshot => {
querySnapshot.forEach(doc => {
this.completeUserProfile[doc.data()['uid']] = {};
this.completeUserProfile[doc.data()['uid']].uid = doc.data().uid;
this.completeUserProfile[doc.data()['uid']].interestIn = doc.data().interestIn;
this.completeUserProfile[doc.data()['uid']].updatedAt = doc.data().updatedAt.toDate();
this.firestore.firestore.collection('userInformation').where('uid', '==', doc.data().uid).limit(1)
.get().then((userInfo) => {
userInfo.forEach(doc => {
this.completeUserProfile[doc.data()['uid']].realName = doc.data().realName;
})
})
console.log(this.completeUserProfile[doc.data()['uid']]);
})
});
}
I can see the results in console.log without issue. However, I cannot get to display my information in html using ngFor loop. Even if I just {{completeUserProfile }}, I will get the result of [object Object].
As I was dealing with Angular for the past month I realized I have to declare the object (in this case completeUserProfile) using : instead of =. But in this case I failed to do so. I need help. I appreciate for your time to read this.