There is a button associated with each element in the list.
<li *ngFor= "let item of itemList">
<button [ngClass]="'button'" (click)="increaseCounter(item)">Click me</button>;
{{item.count}}
</li>
The goal is to have a counter that increments independently for each button. Here's the current implementation:
count: number = 0;
increaseCounter(item) {
item.count++;
}
The issue is that the buttons do not have independent functionality. Is there a way to write a function that works separately for each button?