选项按钮时,请单击Textfield文本,不要禁用
when the option button click textfield text should be erased not disable
我有this Plnkr。启用提供的脚本选项时,文本中的文本框应被删除。
- 点击 Plnkr 中的加号按钮
- 有单选按钮里面的折叠面板。单击提供的脚本按钮。
相关代码:
<table class="range-table" width="100%">
<tr>
<tr ng-repeat="contact in contacts track by $index">
<td>
<accordion>
<accordion-group is-open="status.open" ng-repeat="group in groups">
<accordion-heading>
<span ng-click="opened(group, $index)">{{group.title}}{{contact}}</span><i class="pull-right glyphicon" ng-class="{'glyphicon-chevron-down': status.open, 'glyphicon-chevron-right': !status.open}"></i>
</accordion-heading>
<div> {{group.content}}
<label>
<input type="radio" ng-model="form.Program" value="custom" required /> Customize</label>
<label>
<input type="radio" ng-model="form.Program " value="other" required ng-click="form.OtherProgram = null" /> Provide Script</label>
<input type="text" ng-model="form.OtherProgram" ng-disabled="form.Program != 'other'" name="Program_Other" ng-required="form.Program != 'other'" />
</div>
</accordion-group>
</accordion>
</td>
</tr>
</table>
只需使用 ng-click
将 ng-model
文本输入更改为 null
:
<input type="radio" ng-model="form.Program " value="other" required ng-click="form.OtherProgram = null" />
编辑:
如果我理解这里是更新的答案,请使用自定义变量 disableOption
最初设置为 false,然后使用 ng-click
进行操作,您就完成了:
<label ng-init="disableOption = false">
<input type="radio" ng-model="form.Program" value="custom" ng-click="disableOption = true" required /> Customize
</label>
<label>
<input type="radio" ng-model="form.Program " value="other" ng-click="disableOption = false" required /> Provide Script
</label>
<input type="text" ng-model="form.OtherProgram" ng-disabled="disableOption === true" name="Program_Other" ng-required="form.Program != 'other'" />
我有this Plnkr。启用提供的脚本选项时,文本中的文本框应被删除。
- 点击 Plnkr 中的加号按钮
- 有单选按钮里面的折叠面板。单击提供的脚本按钮。
相关代码:
<table class="range-table" width="100%">
<tr>
<tr ng-repeat="contact in contacts track by $index">
<td>
<accordion>
<accordion-group is-open="status.open" ng-repeat="group in groups">
<accordion-heading>
<span ng-click="opened(group, $index)">{{group.title}}{{contact}}</span><i class="pull-right glyphicon" ng-class="{'glyphicon-chevron-down': status.open, 'glyphicon-chevron-right': !status.open}"></i>
</accordion-heading>
<div> {{group.content}}
<label>
<input type="radio" ng-model="form.Program" value="custom" required /> Customize</label>
<label>
<input type="radio" ng-model="form.Program " value="other" required ng-click="form.OtherProgram = null" /> Provide Script</label>
<input type="text" ng-model="form.OtherProgram" ng-disabled="form.Program != 'other'" name="Program_Other" ng-required="form.Program != 'other'" />
</div>
</accordion-group>
</accordion>
</td>
</tr>
</table>
只需使用 ng-click
将 ng-model
文本输入更改为 null
:
<input type="radio" ng-model="form.Program " value="other" required ng-click="form.OtherProgram = null" />
编辑:
如果我理解这里是更新的答案,请使用自定义变量 disableOption
最初设置为 false,然后使用 ng-click
进行操作,您就完成了:
<label ng-init="disableOption = false">
<input type="radio" ng-model="form.Program" value="custom" ng-click="disableOption = true" required /> Customize
</label>
<label>
<input type="radio" ng-model="form.Program " value="other" ng-click="disableOption = false" required /> Provide Script
</label>
<input type="text" ng-model="form.OtherProgram" ng-disabled="disableOption === true" name="Program_Other" ng-required="form.Program != 'other'" />