One issue I am facing is changing the color of a selected value in a mat select based on a condition. This change should be visually apparent to the user. Although accessing mat-select-value
from the styles is possible, implementing a condition using ng-class is proving to be challenging:
<mat-form-field>
<mat-select name="list"
[style.color]="myCondtition ? 'none': 'green'"
(selectionChange)="change()">
<mat-option *ngFor="let option of options" [value]="currentOption">
{{option.viewvalue}}
</mat-option>
</mat-select>
While properties like [style.font-weight]
, [style.background-color]
, and [style.font-size
] can easily be manipulated, I have noticed that there is no direct way to adjust font-color
. Furthermore, it seems that [style.color] only works with inputs.