In my setup, I have a Top Master select box that can activate or deactivate checkboxes for Master 1 and Master 2. Additionally, each of the Masters has 4 Slave checkboxes that can be activated or deactivated accordingly. The implementation uses ng-model and ng-checked directives.
For example:
<input type="checkbox" ng-checked="top" ng-model="master1"/> Master 1
Now, my query is:
- When the TOP Master is selected, why aren't the slaves of Master 1 and Master 2 automatically selected, even though their ng-models (Master 1 and Master 2) are already selected? However, selecting either Master 1 or Master 2 results in their respective slaves getting selected.
- If all 4 slaves under a Master are selected, the Master itself should also be selected. Furthermore, when both Masters are selected, then the TOP Master should automatically get selected as well. How can this functionality be achieved? And which controller should be utilized for this purpose?
Please review the code on Fiddle http://jsfiddle.net/aF2aL/32/