는 다음 데이터 Angular UI 통해 select2에 부착된다 (Live example here)각도 UI 선택 2 - 자동 정렬을 중지하는 방법?
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
. 예를 들어 '사과'를 선택한 다음 '보트'를 선택하면 selected
항목이 '보트'와 '사과'가됩니다 (이 순서대로!).
어떻게 순서를 유지하고 자동 정렬을 비활성화 할 수 있습니까?
<option ng-repeat="item in items" value="{{item.id}}">{{item.text}}</option>
: 그리고 당신이 본 here
처럼 각 항목에 대한 ng-repeat
을하는 대신 ng-options
를 사용하는 경우는 순서를 유지처럼
이 문제는 Select2의 vanilla JS 또는 AngularUI의 경우에만 발생합니까? – ProLoser
나는 이것이 왜 일어나고 있는지 전혀 모른다. 프로젝트 티켓을 열 수 있습니까? – ProLoser
@ProLoser : https://github.com/angular-ui/angular-ui/issues/406 –