I have a button that changed its text to enable
and disable
on click.
How can I also change the button color,
For e.g. change to Green on enable
and Red on disable
<button (click)="enableDisableRule()">{{status}}</button>
Component
toggle = true;
status = 'Enable';
enableDisableRule(job) {
this.toggle = !this.toggle;
this.status = this.toggle ? 'Enable' : 'Disable';
}
Any help is appreciated. Thanks
ngClass
– Unitive