角度代码
$scope.booleans = [ {
"name" : "True",
"value" : "true"
}, {
"name" : "False",
"value" : "false",
} ];
HTML
<select ng-model="field.insertable" class="form-control" ng-show="editMode"
ng-options="boolean.value as boolean.name for boolean in booleans"></select>
结果HTML
<select ng-model="field.insertable" ng-options="boolean.value as boolean.name for boolean in booleans" class="form-control ng-pristine ng-valid ng-touched" tabindex="0" aria-hidden="false" aria-invalid="false">
<option value="?" selected="selected"></option>
<option value="string:true" label="True">True</option>
<option value="string:false" label="False">False</option>
</select>
所以问题是
value="string:true"
?答案 0 :(得分:0)
你写过字符串值 - &#39; true&#39;并且&#39; false&#39; ,而是写布尔值:
$scope.booleans = [ {
"name" : "True",
"value" : true
}, {
"name" : "False",
"value" : false
} ];