【发布时间】:2023-06-05 04:50:01
【问题描述】:
我的页面中有ng-option 元素。
它在模板中的外观:
<select ng-model="selectedItem" ng-options="item.name for item in items track by item.id"></select>
在控制器中:
$scope.selectedItem = {};
$scope.items = [{name: 'one', id: 30 },{ name: 'two', id: 27 },{ name: 'threex', id: 50 }];
在我的项目中,我从一些查找表中获取范围项。
我需要添加到 ng-select 这个元素的值 -1:
<option value="-1">- manual -</option>
看起来像这样:
<select ng-model="selectedItem" ng-options="item.name for item in items track by item.id">
<option value="-1">- manual -</option>
</select>
这里是Plunker。
但我没有看到 manual 选项。
知道为什么我在视图中看不到手动选项吗?
【问题讨论】:
标签: angularjs angular-ngmodel ng-options angularjs-ng-options angularjs-select