如何使复选框禁用angular.js

时间:2015-08-27 08:45:59

标签: javascript html angularjs twitter-bootstrap checkbox

当我从组合框中选择一个项目时,如何禁用复选框。例如,如果我选择“ABONE”,则angular将使abone复选框禁用。

注意(示例):DefinitionType:ABONE

enter image description here

                  <div class="row">
                <div class="form-group">
                    <label class="control-label col-md-2">Tanım Tipi<sup>*</sup></label>
                    <div class="col-md-3">
                        <select class="form-control" placeholder="Tanım Tipi" ng-options="field.value for field in DefinitionTypes" ng-model="DefinitionType"  required></select>
                    </div>
                </div>
            </div><br />  

                                             EkstraTanımTipi                         

                        <div class="checkboxinsameline" ng-repeat="item in DefinitionTypes">
                            <label>
                                <input type="checkbox" name="item.value" ng-click="DefinitionTypesChecked(item.id)" > {{item.value}}
                            </label>
                        </div>

                    </div>
                </div>
            </div><br />

1 个答案:

答案 0 :(得分:6)

您必须在输入中添加此属性:

ng-disabled="item.value == DefinitionType.value"

当您的输入值等于您选择的模型的值时,这将禁用您的输入。