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

后端 未结 6 1529
一生所求
一生所求 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:14

    async  addToCart(product:Product){
    
      let cartId= await this.getOrCreateCart();
      let item$$=this.getItem(cartId,product.key);
      let item$=this.getItem(cartId,product.key).snapshotChanges();
        item$.pipe(take(1)).subscribe(item=>{
          this.data=item.payload.val();
    
            if(this.data!= null){
              item$$.update({product:product,quantity:(this.data.quantity)+1});
            }else{
              item$$.set({product:product,quantity:1});
            }
    
    
        });
      }
    

提交回复
热议问题