类型“ AngularFireAction <数据库快照> {{} >>”上不存在属性“数量”?

时间:2019-05-06 22:22:49

标签: angular firebase-realtime-database angularfire2

async addToCart(product: Product) {
     const cartId = await this.getOrCreateId();
     const item$ = this.db.object('/shopping-carts/' + cartId + '/items/' + product.key );
     item$.snapshotChanges().pipe(
       take(1)
     ).subscribe(item => {
         item$.update({product, quantity: item.quantity +  1  });
     });
}

在RTDB firebase中进行收集后,我想从中访问值,但遇到此错误:

"Property 'quantity' does not exist on type 'AngularFireAction<DatabaseSnapshot<{}>>' "

这是我的数据库,我想访问item.quantity

enter image description here

0 个答案:

没有答案