When a user chooses an option, a different selection appears as the chosen one. This issue is only present when select2 is enabled. Despite this, ng-model behaves as expected, causing the selected option to differ from what ng-model indicates.
Interestingly, upon clicking on the option for a second time, the correct item is finally selected and displayed, aligning the selection with the model.
example<select class="form-control" ui-select2 class="select2El" ng-model="schedule.deviceid" ng-options="device.deviceid as device.name for device in devices"></select>
The 'devices' variable comprises an array of objects.
If the first shown option is clicked (e.g. option with id: 1), an unrelated option (with id: 30) displays as the selected item. However, Ng-model still shows option 1.
Upon clicking the intended first option again, it will correctly display. The ng-model continues to show option 1.
Versions:
- angular#1.2.16
- select2#3.4.6