I have a button which is inside an ngFor loop. I am styling it like this.
<div *ngFor="let component of componentList;let index =index">
<button type="button" id='Button{{index}}' name='Button{{index}}' class="device_name_button" [ngClass]="{'greencolorstyle':component.status=='Available', 'redcolorstyle': component.status=='Faulted', 'graycolorstyle':component.status=='Unavailable','myClass':isClicked==true}" (click)="selectComponent($event,component.components);" > {{component.name}} </button>
</div>
I am setting isClicked = true with click event handler.
My problem is that when I see the style being applied on the button, after a click, I see, 'device_name_button greencolorstyle myClass'. Whereas on click it should only have 'device_name_button' and 'myClass'.
How do I remove the other classes from this button when someone clicks on this button?