When creating the click event in the shopping cart, it gives an error when inserting the function parameter: "onDelete(cartItem)" I don't understand why the problem. can you help me? Thanks!
CART-COMPONENT.HTML
<button pButton pRipple type="button" label="Remove"class="p-button-danger (click)="onDelete(cartItem)" p-button-text" ></button>
CART-COMPONENT.TS
onDelete(cartItem: CartItem) {
this.cartService.remove(cartItem);
}
CART.SERVICE
remove(cartItem: CartItem) {
const itemIndex = this.cartItems.findIndex(tempCartItem => tempCartItem.id === cartItem.id);
if (itemIndex > -1) {
this.cartItems.splice(itemIndex, 1);
this.computeCartTotals();
}
}```
I tried to remove the parameter but the error persists.