Reputation: 353
getIssuersCollection() {
return this.afs
.collection('issuers')
.snapshotChanges()
.pipe(
map(docArray => {
return docArray.map(doc => {
return {
id: doc.payload.doc.id,
...doc.payload.doc.data()
};
});
})
);
}
The above code worked fine in Angular 8 but throw's an error in Angular 9. Is there an easy fix?
Upvotes: 1
Views: 174
Reputation: 20092
Not sure this help but try to revert the order like this
return {
...doc.payload.doc.data()
id: doc.payload.doc.id,
};
Upvotes: 0
Reputation: 815
use Object.assign({},doc.payload.doc.data) instead of it for quick fix i think
or try ...doc.payload.doc.data() as {}
Upvotes: 2