【发布时间】:2016-04-04 10:39:48
【问题描述】:
我需要一个help.i需要禁用我的一些输入字段当单选按钮选择。我解释下面的代码。
<div class="input-group bmargindiv1 col-md-12">
<span class="input-group-addon ndrftextwidth text-right" style="width:180px">Unit Cost Price :</span>
<input type="text" name="discount" id="ucp" class="form-control" placeholder="Add unit cost price" ng-model="unit_cost_price" ng-keypress="clearField('ucp');" ng-readonly="ucpread" ng-disabled="ucpdis">
</div>
<div class="input-group bmargindiv1 col-md-12" >
<input type="radio" name="favoriteColors" ng-model="isChecked.new">Add new stock
<input type="radio" name="favoriteColors" ng-model="isChecked.old">Update stock
</div>
在上面的代码中,我得到Update stock 默认被选中。我需要当用户选择Update stock 时,上面的Unit Cost Price 字段将被禁用/只读,当用户选择Add new stock 时,它将被启用。请帮帮我。
【问题讨论】:
-
试试
ng-disabled="isChecked.new" -
我测试了,但它没有来。
标签: javascript angularjs radio-button