角度4等于ng-disabled

时间:2018-02-20 13:34:12

标签: html angular

我有两个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>

1 个答案:

答案 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"/>