I do not know what is the best way to implement this, I am trying with switch without success ... When I click the button, I want to increment the "qtd" property;
choice=[
{"id":"1","name":"PRODUTO1","qtd":"0"},
{"id":"2","name":"PRODUTO2","qtd":"0"},
{"id":"3","name":"PRODUTO3","qtd":"0"},
];
addQtd(id){
switch(id){
case '1':
this.choice[0].qtd++;
break;
case '2':
this.choice[1].qtd++;
break;
case '3':
this.choice[2].qtd++;
break;
}
}
<div *ngFor="let item of choice">
<button (click)="addQtd(item.id)">Add</button>
</div>