angular-ui / ui-select2

AngularJS wrapper for select2 (deprecated, use angular-ui/ui-select)
https://github.com/angular-ui/ui-select
MIT License
595 stars 444 forks source link

The select2('val') method was called on an element that is not using Select2 #316

Closed patilharshal16 closed 6 years ago

patilharshal16 commented 6 years ago

I am using Select2 4.0.5 version while updating the selected values of element I am facing this issue although I tried initializing select2 on element initially and then adding selected values again without initializing select2 on the element I tried adding selected values also did vise-versa.

beta1007 commented 6 years ago

Update the following to look for class name.

elm.bind("$destroy", function () { if (elm.hasClass('.select2-offscreen')) { elm.select2("destroy"); } });

patilharshal16 commented 6 years ago

@beta1007 thanks for the update. I already fixed this issue.