【问题标题】:Angular 4 eqvalent of ng-disabled [duplicate]Angular 4相当于ng-disabled [重复]
【发布时间】:2018-07-30 21:21:05
【问题描述】:

我有两个复选框,当第二个被点击时,一个被禁用。我已经在 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>

【问题讨论】:

    标签: html angular


    【解决方案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"/>
    

    【讨论】:

    • 我已经尝试过同样的方法,也尝试过 [(ngModel)] 但我就是无法让它工作
    • ohhh 它现在工作了我需要将其他输入定义为独立的。像这样,[(ngModel)]="body.name" [ngModelOptions]="{standalone: true}
    猜你喜欢
    • 2017-09-10
    • 2018-07-10
    • 2015-12-13
    • 1970-01-01
    • 1970-01-01
    • 2015-11-27
    • 2018-06-06
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多