AngularJS ngOptions将“string:”添加到选项值

时间:2015-05-13 18:14:31

标签: javascript angularjs ng-options

我为select选项构建了以下数组:

$scope.typeOptions = [
    { name: 'Pontos', value: 'PONTOS' },
    { name: 'Multipla Escolha', value: 'MULTIPLA_ESCOLHA' },
    { name: 'Texto', value: 'TEXTO' }
];
$scope.type = $scope.typeOptions[0].value;

在我的HTML视图中使用以下内容

<select ng-model="type" required="required" ng-options="t.value as t.name for t in typeOptions">
</select>

然后它给了我以下内容:

<select ...>
    <option value="string:PONTOS" label="Pontos" selected="selected">Pontos</option>
    ...
</select>

string:添加到每个值的开头。如何删除它?

编辑:虽然有人说这是故意的,但HTML上显示的这个值与实际值不符,但在提交表单时,收到的值会随"string:"一起提供部分也是如此。

0 个答案:

没有答案