angular-bootstrap-multiselect icon indicating copy to clipboard operation
angular-bootstrap-multiselect copied to clipboard

ng-change fired twice?

Open AnimaLupi opened this issue 8 years ago • 1 comments

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

AnimaLupi avatar Oct 10 '17 13:10 AnimaLupi

<select ng-model="selectedOption" ng-options="option for option in options" ng-change="handleSelectionChange()">
  <option value="">Select an option</option>
</select>

ljluestc avatar Nov 12 '23 22:11 ljluestc