I have this cart component that I use for getting the cart data from the back end.
import { Component, OnInit } from '@angular/core';
import { CartService } from './cart.service';
@Component({
selector: 'cart',
templateUrl: './cart.component.html',
styleUrls: ['./cart.component.css']
})
export class CartComponent implements OnInit{
carts: any;
cartItems: any;
totalPrice: Number;
constructor(private _cartService: CartService){};
ngOnInit(){
this.getItems();
}
getItems(){
this._cartService.getCartItems(localStorage.getItem('currentUserId'))
.subscribe((cart) => {
this.cartItems = cart.products;
this.totalPrice = cart.totalPrice;
this.carts = cart;
console.log(this.carts)
},
(err) => console.log(err));
}
}
This is my object values.
I put all the products inside cartItems as shown on my component and loop it in my template using *ngFor
<tbody *ngFor="let cartItem of cartItems">
This is the result
Now I want to update the quantity of one item, press the refresh button beside the remove button then it will send just the product details that I have the refresh button pressed to my back end.
Can someone help me on how to make it happen?

