其他的答案似乎在頂部,而不是底部添加的元素。
如果您想在列表末尾添加一些東西,您可以隨時將其添加到JavaScript中。
查看工作plunk,改編自角select documentation。
下面
主要部分複製:
(function(angular) {
'use strict';
angular.module('defaultValueSelect', [])
.controller('ExampleController', ['$scope', function($scope) {
$scope.data = {
availableOptions: [
{id: '1', name: 'Option A'},
{id: '2', name: 'Option B'},
{id: '3', name: 'Option C'}
],
selectedOption: {id: '3', name: 'Option C'} //This sets the default value of the select in the ui
};
// Add the alternative option
// may need to use $digest, depending on where in the process you do this.
$scope.data.availableOptions.push({ id: '', name: 'None of the above'})
}]);
})(window.angular);
你是問如何只是有一個值=「」選項在最後,還是你想空白輸入域,這是唯一可見的或活動時,別人被選中? – Kip
空的