Tomasz Kuter
Tomasz Kuter

Reputation: 666

How to reset counter of cart items

I modified Angular sample shopping cart app and I cannot reset counter of cart items in correct way. After submitting the form counter should be zero.

Here is what I managed to do: the application. You can edit my code in any way you wish.

Any help will be very appreciated :)

Upvotes: 0

Views: 176

Answers (2)

Aakash Garg
Aakash Garg

Reputation: 10979

Here you go :- https://stackblitz.com/edit/angular-5gw71r-ksjm5m. You had a tight coupling between card and topbar. I removed it and made it flexible.

Upvotes: 1

Diogo Santos
Diogo Santos

Reputation: 69

This works for me

clearCart() {
    this.items.length = 0;
}

I just can't explain you what is happening, hopefully someone can.

Upvotes: 0

Related Questions