-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
When data changes the value on select gets overriden with the first value in the 'data' list #136
Comments
I have the same problem, some solution? |
I have the same problem, any way to solve? |
I have the same problem |
the pr #134 solved it. |
until hassegawa's fix gets merged in I found a workaround solution that may be useful. I set my
The above snippet makes use of epoch time to ensure that each option is given a unique id. |
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Hi guys,
I am having a problem. When my select2 is populated with countries the valueChanged is being triggered with the first element of the countries list. Doing some digging I found that when the countries collection changes (from [] to a collection of countries), the whole select is distroyed and a new is created. And the newly created loads the first element of the data list as its value.
<select2 #countryInput="ngModel" name="country" [data]="countries" [width]="'100%'" [options]="selectOptionsCountry" (valueChanged)="formObj.countryCode = $event.value" [(ngModel)]="formObj.countryCode" ngDefaultControl required> <option></option> </select2>
Does anybody have found a workaround for this??
Btw, the workaround I find is to make sure the countries are loaded before the formObj I am editing, but that's kinda hackky, looking for a better solution.
Thanks
The text was updated successfully, but these errors were encountered: