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 #301

Open dincoo opened 8 years ago

dincoo commented 8 years ago

is my configure error? TypeError: Cannot read property 'val' of undefined

ralphdev22 commented 7 years ago

I have reset button on my form. In my reset function, i put this $('.select2').select2("val", ""); so that the my select2 input will be reset too. but there's an error.

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

Please help?????

kolte commented 6 years ago

I am facing the same issue, any idea?

DhirenGangal commented 6 years ago

Make sure to any script call while on change event. If yes then make sure it properly work or not.

beta1007 commented 6 years ago

Update the js to look for class name before destroy.

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