2013-11-27 99 views
1

我正在尝试使用角js做复选框的模型绑定。复选框值正确绑定,但未显示为所选的偶数值对于复选框为真。模型绑定与角js

下面是代码

<input type="checkbox" id="checkboxDontKnowWaistSize" required value="True" ng-value="True" name="ServiceObject.DontKnowWaistSize" data-ng-model="BodyMassIndexForm.DontKnowWaistSize" class="checkbox" data-ng-init="BodyMassIndexForm.DontKnowWaistSize=True" > 

回答

0

尝试属性NG-检查:从角1.2.1源代码

提取物:

@description 
* The HTML specification does not require browsers to preserve the values of boolean attributes 
* such as checked. (Their presence means true and their absence means false.) 
* This prevents the Angular compiler from retrieving the binding expression. 
* The `ngChecked` directive solves this problem for the `checked` attribute. 
* @example 
    <doc:example> 
     <doc:source> 
     Check me to check both: <input type="checkbox" ng-model="master"><br/> 
     <input id="checkSlave" type="checkbox" ng-checked="master"> 
+0

你做什么进展? – angabriel