I want to Increment/Decrement when the user presses the add button, then update the amount value accordingly. I've tried a couple of times, but unfortunately I was not successful!
Here is the code:
addToCart(){
this.amount = 1;
}
addItem(){
this.amount++;
console.log('plus is : '+this.amount++)
}
removeItem(){
this.amount--;
console.log('plus is : '+this.amount--)
}
HTML:
<div (click)="addToCart()">ADD</div>
<div (click)="removeItem()" class="btnSign">-</div>
<div>{{amount}}</div>
<div (click)="addItem()" class="btnSign">+</div>
++) beforeconsole.logand also within theconsole.logstatement.