对不起,如果这似乎是一个简单的问题,但我无法搞清楚,也找不到解决办法。我是angularJS的新手,有一个网页,它有两个单选按钮和一个“细节”按钮。
显然,该网站是用angularJS编写的,而且还使用twitter引导。
问题是“细节检查过了吗?”有一个“是”和“不是”单选按钮。
单击“详细信息”按钮将打开一个带有“关闭”按钮的模态,并在其上显示详细信息。
我想要的是禁用这些单选按钮,直到单击了"Details“按钮或一旦从模式中单击了"Close”按钮(这是最好的解决方案)。
我唯一能提供的代码是我的HTML。我需要在不使用JQuery的情况下完成它。
<div class="row" style="margin-bottom: 5px">
<label class="col-sm-6 col-md-5" style="padding-top: 10px;">Have sufficient checks been performed?</label>
<div class="col-sm-2" style="padding-top: 6px;">
<input name="amlcheckgroup" type="radio" ng-model="withdrawalitems.checkscompleted" value="Yes" required />Yes
<input name="amlcheckgroup" type="radio" ng-model="withdrawalitems.checkscompleted" value="No" required />No
</div>
<div class="col-sm-2" style="padding-left: 0px">
<button type="button" class="btn btn-success" ng-click="opendatachecksmodal()" title="Click to see details.">Data Checks</button>
</div>
</div>发布于 2015-05-07 07:44:29
您必须查找ngDisabled指令。
<input type="radio" ng-disabled="!enableRadioButton">
<button ng-click="enableRadioButton = true">Details</button>编辑
由于您添加了一个代码示例,这样的操作应该可以做到:
<div class="row" style="margin-bottom: 5px">
<label class="col-sm-6 col-md-5" style="padding-top: 10px;">Have sufficient checks been performed?</label>
<div class="col-sm-2" style="padding-top: 6px;">
<input name="amlcheckgroup" type="radio" ng-model="withdrawalitems.checkscompleted" value="Yes" required ng-disabled="enableRadioButtons" />Yes
<input name="amlcheckgroup" type="radio" ng-model="withdrawalitems.checkscompleted" value="No" required ng-disabled="enableRadioButtons" />No
</div>
<div class="col-sm-2" style="padding-left: 0px">
<button type="button" class="btn btn-success" ng-click="opendatachecksmodal()" title="Click to see details.">Data Checks</button>
</div>
</div>将$scope.enableRadioButtons = true;添加到opendatachecksmodel()方法中。
您也可以在关闭模式时将标志设置为true。
https://stackoverflow.com/questions/30094783
复制相似问题