我有1个Top Master选择框,其中(de)激活Master 1和Master 2复选框。 Master 1和2可以(de)激活每个4 Slave复选框。我在这里使用ng-model和ng-checked。
e.g。
<input type="checkbox" ng-checked="top" ng-model="master1"/> Master 1
我的问题:
答案 0 :(得分:-1)
您需要将ng-checked =“master1”更改为ng-checked =“(master1 || top)&amp;&amp; master1”
<div ng-controller="myCtrl">
<input type="checkbox" ng-model="top"/> Top Master
<ul> <input type="checkbox" ng-checked="top" ng-model="master1"/> Master 1
<ul ng-repeat="slave in slaveOne">
<input id="checkSlave" type="checkbox" ng-checked="(master1||top)&&master1"/>{{slave.name}}
</ul>
</ul>
<ul> <input type="checkbox" ng-checked="top" ng-model="master2"/> Master 2
<ul ng-repeat="slave in slaveTwo">
<input id="checkSlave" type="checkbox" ng-checked="(master2||top)&&master2"/> {{slave.name}}
</ul>
</ul>