尝试从firestore(angular / ionic)获取数据时出现此错误
PizzaProvider.ts
getAllPizzas() {
return this._afs.collection<Pizzas>('pizzas', ref => ref);
}
比萨饼-list.ts
pizzas: Observable<any[]>;
// Function
this.pizzas = this._pizzaProvider.getAllPizzas().snapshotChanges().pipe(
map(arr => arr.map(doc => {
return { id: doc.payload.doc.id, ...doc.payload.doc.data() }
}))
);
我收到了错误:
ERROR TypeError: changes.forEach is not a function
at combineChanges (changes.js:19)
at ScanSubscriber.accumulator (changes.js:15)
at ScanSubscriber._tryNext (scan.js:111)
at ScanSubscriber._next (scan.js:104)
at ScanSubscriber.Subscriber.next (Subscriber.js:93)
at MapSubscriber._next (map.js:85)
at MapSubscriber.Subscriber.next (Subscriber.js:93)
at MapSubscriber._next (map.js:85)
at MapSubscriber.Subscriber.next (Subscriber.js:93)
at RefCountSubscriber.Subscriber._next (Subscriber.js:129)
我做错了什么?