Dynamic conditional style background of unchecked checkboxes


#1

Hey There,
i want to style the background of unchecked checkboxes dynamically.
The color attribute of ion-checkbox let me change easily the background of checked checkboxes. But how can i change the unchecked Checkbox background dynamically with different conditions?

I have some multiple choice questions. After the user answered it shows alle possible answers. The wrong should be red and the correct should be green. Also the users answers checkbox should be checked.
Currently the code looks like that:
<ion-item *ngFor=“let response of responses”
[style.background-color]=“getBackground(response)”>
{{response.text}}

The getBackground function like this:
getBackground(response: Response): string {
var background;
if (response.isSolution == “true”) {
background = this.correctAnswerBackground;
} else {
background = this.wrongAnswerBackground;
}
return background;
}

Therefore the complete item is styled with the background color. But i only want to style my checkboxes. Is this possible?

Thanks in advance for your help