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.
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.
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.
This seems to check or uncheck all of them and not allow individual checking.
You have to assign different variables for each checkbox. Like aBooleanVariable1, aBooleanVariable2, aBooleanVariable3, etc.
How to assign different variable to each checkbox when my list of checkbox is dynamic?! There must be other way around.
I imagine that you have an array of objects. ngFor those checkboxes and set the value as the property you want to show.