Uncheck all checkboxes


#1

How do I programmatically uncheck all check boxes given a certain class?

I know the ion-checkbox is rendered as a button so just setting the attribute on the element doesn’t work.


#2

Actually, you can do this:

<ion-checkbox [(ngModel)]="aBooleanVariable"></ion-checkbox>

Assign a boolean variable to each checkbox you have. Then, add a button and a function that, when clicked, assign a true or false value to all of your boolean variables.


#3

This seems to check or uncheck all of them and not allow individual checking.


#4

You have to assign different variables for each checkbox. Like aBooleanVariable1, aBooleanVariable2, aBooleanVariable3, etc.