Angularjs的输入[radio]带有唯一的ng-model,不能取消设置
Angularjs input[radio] with unique ng-model not unsetting
简单的问题,当使用单选按钮集合时,每个按钮使用唯一的ng-model
,当其中一个未选中时,模型的值不会从true
更改为false
。
在这个例子中,当未选中时,每个模型仍然保留'true':
<form>
<label for='qpInputdata'>No Selection</label>
<input id="qpInputdata" class="form-control
name="xCaasType" ng-model="fData.xNone" type="radio"
ng-value="true" value="true">
<label for='qpInputdata'>Select This One</label>
<input id="qpInputdata" class="form-control
name="xCaasType" ng-model="fData.xNotNone" type="radio"
ng-value="true" value="true">
</form>
一如既往,感谢您的指导。
你的表单应该是这样的
<form>
<label for='qpInputdata'>No Selection</label>
<input id="qpInputdata" class="form-control
name="xCaasType" ng-model="fData.selection" type="radio"
ng-value="true" value="no">
<label for='qpInputdata'>Select This One</label>
<input id="qpInputdata" class="form-control
name="xCaasType" ng-model="fData.selection" type="radio"
ng-value="true" value="selected">
</form>
现在模型fData。选择将保留这两个值中的一个"no","selected"根据所选选项
相关文章:
- ng-repeat不能作为参数传递
- ng隐藏&ng显示不能仅在特定的AngularJS页面中工作
- Angular2多维数组ng-for不能工作
- ionic ng-if不能在模板视图中将$index作为作用域的索引
- Angularjs的ng-model不工作输入[text])
- AngularJS:在ng-if中输入ng-model不工作
- Angular/Bootstrap: ng-hide不能正常工作
- ng-repeat中的Ng-click不能使用:focus和display
- AngularJS的ng-dialog不能与Select2一起工作
- AngularJS: ng-model不清除输入
- 附加Html代码中的Angular ng-model不起作用
- Ng-model不触发变更事件
- 当jquery属性选中复选框时,Angular ng-model不更新
- Ng-Grid:不能读取属性'on'零
- Angular的ng-view不能与express一起工作
- Ng-model不能在ng-include中工作
- AngularJS的ng-model不能与ng-include一起使用
- 由于作用域问题,Ng-model不能工作
- AngularJS. ng-model不能工作
- 为什么按ng键不能改变ng-model的值?