Hello, I'm trying to use ng-change with this directive.
I've noticed that from time to time the ng-change callback gets called twice.
I think this happens when the newly selected option is being added among the selected ones and that triggers a reordering of the array (i.e. the newly selected option gets inserted in the middle or the start of the selected options).
The model is first updated with the newly selected option at the end (1st on-change), then it's sorted to proper order (2nd on-change).
<select ng-model="selectedOption" ng-options="option for option in options" ng-change="handleSelectionChange()">
<option value="">Select an option</option>
</select>
Hello, I'm trying to use ng-change with this directive.
I've noticed that from time to time the ng-change callback gets called twice.
I think this happens when the newly selected option is being added among the selected ones and that triggers a reordering of the array (i.e. the newly selected option gets inserted in the middle or the start of the selected options).
The model is first updated with the newly selected option at the end (1st on-change), then it's sorted to proper order (2nd on-change).
Thank you,
Andrea