Is there a way to make the like count increment and decrement with the same button click? Currently, the code I have only increments the like count. How can I modify it to also allow for decrements after increments?
<button (click)="toggleLike()">{{count}}</button>
export class TheComponent {
public count = 10;
public toggleLike() {
this.count += this.count === 10 ? -1 : 1;
}
}