-
Notifications
You must be signed in to change notification settings - Fork 439
Select2 triggers onchange when init #153
Comments
check this #173 |
I don't know about #173 or related issues, I think this is slightly different. There are several variables in play that makes a single solution difficult. (for example, whether you're using a SELECT tag or not, the code does different things - I am using a DIV because I want to use tags). I have two solutions to prevent the onchange event on init:
to:
* I don't understand why controller.$setViewValue() is even needed. It's being passed an array of values from the same array inside controller.$modelValue, but it's a new array because first it's translated by select2, than re-translated by convertToAngularModel, hence $setViewValue() triggers the onchange event. |
+1 for this! |
ui-select2 is deprecated, you should use https://github.com/angular-ui/ui-select instead. It is very unlikely that this issue will be fixed. |
When the page loads, the ui.select2 will trigger a change event even though the select wasn't touched. It seems to be this line's culprit: https://github.com/angular-ui/ui-select2/blob/v0.0.5/src/select2.js#L127
What does this do ?The comment above it doesn't really help ...
The text was updated successfully, but these errors were encountered: