angular-sortablejs is compatible with angular 5?

2.1k Views Asked by At

i was trying to use angular-sortables to sort the dragged(by ng-drag-drop library) list items but seems like nothing is happening by using it too. Can someone tell me if it is compatible with angular 5 or not ?

Below is my code :

<div class="card-header card-inverse card-primary">Drop Anything here</div>
  <div class="card-block scroll-list" [sortablejs]="droppedHorizontalItems" [sortablejsOptions]="{ animation: 150 }">
    <li 
      [draggable]
      [dragClass]="'active'"
      [dragData]="item"
      [dragScope]="item.type"
      [dragEnabled]="dragEnabled"
      *ngFor="let item of droppedHorizontalItems;let in=index"
      class="horizontal list-group-item"
    >
      {{item.name}}
    </li>
  </div>
</div>
3

There are 3 best solutions below

1
On

Well, this is the information from angular-sortablejs github page:

Angular >= 4.x ([email protected]; sortablejs must be installed separately)

npm install --save sortablejs && npm install --save angular-sortablejs

So, I think that you shouldn't have any problem with it.

P.S. Sorry, but I didn't see your example. Maybe it'll be better to add plunker link.

0
On

angular-sortables doesn't work with any angular version >= 2.0.

Instead of that, you can use https://github.com/SortableJS/angular-sortablejs.

0
On

angular-sortablejs works with angular 2, 4, 5 and will work with future versions.

Source: I'm the maintainer of the project. If you need further help feel free to ask at the github repo's issues page.