@harshm90 wrote:
Hello,
I have an Array of item in shopping cart i want to update the quantity of particular item in cart when user clicks the inc or dec button
my ts file
// Fetching the data in shopping cart this.storage.get('products').then(data => { for (var i = 0; i < data.length; i++) { this.bag.push(data[i]); } for (var i = 0; i < this.bag.length; i++) { this.item_qty = this.bag[i].qty; } this.incQuant(); this.decQuant(); } ); decQuant() { if (this.item_qty - 1 < 1) { this.item_qty = 1; } else { this.item_qty -= 1; } } incQuant() { this.item_qty += 1; console.log(this.item_qty); }
With the above code the items are being updated but instead of updating the quantity of particular item its increasing every items quantity.
how can i make the it update only the selected items’s quantity
Please help…
Posts: 1
Participants: 1