我正在使用bootstrapDualListbox
JS
$('select[name="duallistbox_demo1[]"]').bootstrapDualListbox({
moveOnSelect: false
});
HTML
<select multiple="multiple" size="10" name="duallistbox_demo1[]" ng-model="selectedStaff"><option ng-repeat="staff in staffs" value="{{staff.userId}}">{{staff.firstName}} {{staff.lastName}}</option>
</select>
如果我将选项用作不同的值(不是来自ngRepeat),交换就可以了。如果我使用ng-repeat,则在选择时所有值都交换而非选择。我怎么解决这个问题?
答案 0 :(得分:0)
请使用ng-options检查选项,而不是使用ng-repeat选项。
<select multiple="multiple" size="10" ng-options="staff as staff.firstName for staff in staffs track by staff.userId" name="duallistbox_demo1[]" ng-model="selectedStaff">