Changing icon color dynamically
in the below code only the icon image changes not the color.
Doesn’t [color] binding work for ion-icon?
.HTML
<ion-icon padding margin [name]="getIcon()" [color]="getIconColor()"></ion-icon>
.TS
getIcon() {
if (this.isInputValid || this.isInputValid == undefined) {
return "ic-check";
} else {
return "ic-cross";
}
}
getIconColor() {
if (this.isInputValid || this.isInputValid == undefined) {
return "primary";
} else {
return "danger";
}
}