Drag and drop sortable ng:repeats in AngularJS?

Nick Retallack picture Nick Retallack · Sep 8, 2011 · Viewed 81.2k times · Source

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

Guillaume86 picture Guillaume86 · Aug 12, 2012

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>