I want to change my buttons color on event. I tried 2 approaches but both failed. With the first option I even couldnt start the app anymore, with the second option the color just doesnt change.
1. HTML
<ion-button [color]="done ? 'primary' : 'danger'"> </ion-button>
TS
public done: boolean = true;
func() {
this.done = !this.done;
}
2. HTML
<ion-button (click)="toggleNamedColor()"></ion-button>
TS
public ionicNamedColor: string = 'light';
public ionicNamedColor2: string = 'primary';
public toggleNamedColor(): void {
if(this.ionicNamedColor === 'light') {
this.ionicNamedColor = 'primary'
} else {
this.ionicNamedColor = 'light'
}