I want to change the color of the selected label. I'm using --color-selected in CSS, but it doesn't work.
Html
<ng-container *ngFor="let item of daily">
<ion-label id="daysName" (click)="dayName($event)">{{item.day}}</ion-label>
</ng-container>
TS
dayName($event) {
console.log('dayName', $event.target.innerHTML)
}
CSS
#daysName {
color: white;
--color-selected: red;
}
ion-label.favorites-label {
--color-selected: red;
}
CodePudding user response:
You can use ngClass:
[ngClass]="{'favorites-label': step === 'step1'}"
Or
[class.favorites-labels] = "step === 'step1'"