Question

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.

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top