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
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});
}
});
}