这是我的角度js html块
MiscellaneousFunctions.ToFirstLastFunction.apply(something)
这是我的json格式输出块
<select name="input_type0" id="select-type-CA0" ng-model="webfront.customer_fields[$index].input_type" class="ng-valid ng-not-empty ng-touched ng-dirty">
<option value="? number:2 ?"></option>
<option value="Type">Type</option>
<option ng-selected="webfront.customer_fields[$index].input_type == 1" value="1">Textbox</option>
<option ng-selected="webfront.customer_fields[$index].input_type == 2" value="2" selected="selected">Text area</option>
<option ng-selected="webfront.customer_fields[$index].input_type == 3" value="3">Radio Button</option>
<option ng-selected="webfront.customer_fields[$index].input_type == 4" value="4">Dropdown</option>
</select>
编辑时,下拉值未填充。我是棱角分明的新手,我无法找到解决方案的正确方法
答案 0 :(得分:0)
您应该将其更改为使用ng-options
,如下所示:
控制器:
$scope.options = [
{ value: 1, name: "Textbox" },
{ value: 2, name: "Text area" },
{ value: 3, name: "Radio Button" },
{ value: 4, name: "Dropdown" }
];
在你看来:
<select name="input_type0" id="select-type-CA0"
ng-model="webfront.customer_fields[$index].input_type"
ng-options="option.id as option.name for option in options">
<option value="">Type</option>
</select>