Property 'pipe' does not exist on type 'AngularFireObject<{}>'

后端 未结 6 1578
一生所求
一生所求 2021-01-03 17:00

I\'m a beginner to Angular. I\'m watching the tutorial of Mosh Hamedani using the Angular version 6 but the problem is the tutorial version is 4. I\'m working on the e-comme

6条回答
  •  佛祖请我去吃肉
    2021-01-03 17:16

    Make following changes in your code:

    async addToCart(product: Product){
        let cartId = await this.getOrCreateCartId();
        let item$ = this.getItem(cartId, product.key);
        item$.snapshotChanges().pipe(take(1)).subscribe(item => {
           item$.update({ product: product, 
                          quantity: (item.payload.exportVal().quantity || 0) + 1 });
        });
    }
    

    Just check-out my Github repository My Github Link which is built in Angular 7. Your Angular 6 project will work fine.

提交回复
热议问题