答案 0 :(得分:4)
有一种简单的方法可以阻止只包括
<option value="" ng-show="false"></option>
如下所示选择
<select ng-options="item as item.name for item in items" ng-model="currentItem" size="5" style="width: 200px">
<option value="" ng-show="false"></option>
</select>
<强> Working Demo 强>
更新1
我已经解决了不突出显示最后一项的问题,看看工作演示
$scope.removeItem = function () {
var index = $scope.items.indexOf($scope.currentItem);
$scope.items.splice(index, 1);
index === $scope.items.length ? $scope.currentItem = $scope.items[index - 1] : $scope.currentItem = $scope.items[index];
};
<强> Working Demo 强>