Updating the Count of Products in Cart
Learn to update product count in the cart using a service.
We'll cover the following...
We'll cover the following...
We need to specify the number of products in the cart. This functionality can be implemented by updating cart-service.
Updating the cart-service file
Let’s open the app/services/cart-service.js file and add the required functionality:
- Lines 4–20: We create a class named
Productand initialize all the values:- Line 5: We create a tracked property named