Urban Maciej Urban Maciej - 4 months ago 39
AngularJS Question

Sortable not working AngularJS / UI

I'm trying to get my list sortable with AngularUI

plunker:

http://plnkr.co/edit/2zbn2rBpnat8lEQZRGd9?p=preview

<ul ui-sortable ng-model="deals.numer">
<li ng-repeat="deals in list" class="bg-info" style="padding: 5px; margin: 5px;">


is it possible to make this list sortable after adding few new elements to array?

Answer

To make you plunker work:

  • Add jquery and jqueryUI as a dependency
  • Add ui.sortable as a module dependency:

    angular.module('myApp', ['ui.sortable']);
    
  • Replace:

    <ul ui-sortable ng-model="deals.numer">
    

    with:

    <ul ui-sortable ng-model="list">
    

See plunker