The Sortable enables you to bind it to an array of strings or objects, as well as to use its built-in directive to decrease the repetitive boilerplate code.
You can set the
data property of the Sortable component to an array of strings or objects.
Sorting items by using either drag-and-drop operations or the keyboard navigation will emit events, such as
dragEnd, and others. The events provide the necessary information for manipulating the dataset manually or through the API of the Sortable.
The Sortable provides the built-in
SortableBindingDirective directive, which simplifies the handling of data operations by cutting down the repetitive boilerplate code.
SortableBindingDirective will seamlessly keep the Sortable items and the data array that is passed to it in sync.
The following example demonstrates how to set up the binding.