Migrating from v1.x

The Sortable v2.0.0 was released in November 2018 and introduced major changes in the behavior of the component.

Changes

Sortable v1.x Sortable v2.x and later
* The SortableComponent handles all operations internally and changes [data] on the fly. * The SortableComponent does not handle operations and no longer automatically updates the [data] array. This means that while the dragging of items will provide visual cues, it is now the application that has to subscribe to the Sortable events and call its API methods for adding, moving or removing items.
* The SortableComponent emits events continuously in a similar way in which the native drag events are emitted by the browser. * The SortableComponent emits a single drag event each time an item is dragged over another item.
* n/a * You can prevent the default behavior of each event by using the preventDefault method of the event argument.

Data-Binding Directive

Since the Sortable does not automatically update the [data] array, you need to use the SortableBindingDirective to handle the scenarios which were previously provided for out of the box and avoid repetitive code.

In this article