<input type="checkbox"
ng-checked="testModel.child_1 && testModel.child_2 && testModel.child_3 && testModel.child_4 && testModel.child_5"
ng-model="isChecked"/>
My goal is to understand the documentation on ng-checked
and its appropriate use with ng-model
when using a checkbox. I actually thought I had understood it and was attempting to write some examples.
I thought that it could be used to select and deselect all children checkboxes while updating the ng-model
for each child. I can use ng-model
to store the check value in scope only when a child is selected by the user. When the parent is selected its value is reflected as changed it does not change any of the children.
I have three examples in my fiddle and the first shows the behaviour I expected in the other two examples. IOW, I am surprised that the children checkboxes are not initiated with the testmodel nor are the parent values ever registered with the testmodel. Is this the expected out of the box behaviour or is there something wrong with my debugging?