我有两个ckeckbox,其中一个在单击第二个时被禁用。我是在angularjs中完成的,但是在angular 5项目中却无法做同样的事情?
<li>
<div class="checkbox-inline">
<input type="checkbox" class="notWorking" ng-model="body.NotWorkShift" ng-disabled="body.All"/>
<label translate >Notworkshift</label>
</div>
</li>
<li>
<div class=" checkbox-inline ">
<input type="checkbox" class="allCars" ng-model="body.All" />
<label translate>AllCars</label>
</div>
</li>
答案 0 :(得分:1)
更改
<input type="checkbox" class="notWorking" ng-model="body.NotWorkShift" ng-disabled="body.All"/>
到
<input type="checkbox" class="notWorking" ng-model="body.NotWorkShift" [disabled]="body.All"/>