Change color dinamically

Hi, how can I change the color of laber or checkbox depending if the time is available? I have tried this and by another ways, but I can’t resolve it.

<ion-list *ngSwitchCase="'morning'">
		<ion-item *ngFor="let time of morningTimes">
			<ion-label color="time.available ? 'primary' : 'danger'">{{time.hour}}</ion-label>
			<ion-checkbox color="time.available ? 'primary' : 'danger'"
										checked="{{!time.available}}" (change)="onCheckboxChange($event, item)" disabled="{{!time.available}}"></ion-checkbox>
		</ion-item>
</ion-list>

Someone can help me?

for some similar problem I use a watch on a rgb(255,255,255) public attribute

[ngStyle]="{'background-color': scoreColor}"

1 Like