以下数据通过
Angular UI附于
select2:(
Live example here)
@H_403_26@解决方法
JS:
$scope.items = [ {id: 1,text: 'elephant'},{id: 2,text: 'desk'},{id: 3,text: 'car'},{id: 4,text: 'boat'},{id: 5,text: 'apple'} ]; $scope.selected = [];
HTML:
<select ui-select2 multiple ng-model="selected" data-placeholder="Please select..." style="width:200px"> <option></option> <option ng-repeat="item in items" value="{{item.id}}">{{item.text}}</option> </select>
但是,每次选择项目时,它都会按ID对所选项目进行排序.例如,如果您选择“apple”然后选择“boat”,则所选项目将为“boat”和“apple”(按此顺序!).
我怎样才能保留订单并禁用此自动排序?