Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angularjs ui-select2 does not render on drag drop with ui-sortable in ng-repeat

I am running into in issue while using ui.select2 with ui.sortable in angular js. Here is the plunkr demonstrating it http://plnkr.co/edit/dxM6r6IInN7goXYPmqrl?p=preview

Here select2 is rendered perfectly on page load, but as I drag-n-drop the element in the list the ui-select2 is not rendered any more.

like image 428
icanbeacoder Avatar asked May 22 '26 20:05

icanbeacoder


1 Answers

ui.select2 listens to the $destroy event:

elm.bind("$destroy", function() {
  elm.select2("destroy");
});

and apparently this event is fired after a reorder (which should't happen).

Luckily, this issue seems to be fixed by using the latest version of angular-ui-sortable. Here's the modified plunkr, which works as expected: http://plnkr.co/edit/nSZIZNsrHX0KBppYbYoF?p=preview

like image 112
Intru Avatar answered May 24 '26 10:05

Intru



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!