Get sortable instance from ng-sortable directive in controller

139 Views Asked by At

How can I get the sortable instance from a ng-sortable directive (https://github.com/RubaXa/Sortable/blob/master/ng-sortable.js) without a reference? I expected something like this to work, but it doesn't (option is not a function):

angular.element(element[0].querySelector('ol')).option('disabled', true);
1

There are 1 best solutions below

0
On

I think it doesn't work because the ng-sortable plugin doesn't provide a reference to the created Sortable instances. I ended up writing an own Sortable directive which utilizes jQuery so I can approach the Sortable instance via that.