Nick Retallack Nick Retallack - 2 months ago 8
AngularJS Question

Drag and drop sortable ng:repeats in Angular.JS?

Is it at all easy to use

jQuery.sortable
on
ng-repeat
elements in AngularJS?




It would be awesome if re-ordering the items automatically propagated that ordering back into the source array. I'm afraid the two systems would fight though. Is there a better way to do this?

Answer

Angular UI has a sortable directive,Click Here for Demo

Code located at ui-sortable, usage:

<ul ui-sortable ng-model="items">
  <li ng-repeat="item in items">{{ item }}</li>
</ul>
Comments