2013-11-27 30 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