SortableService

The service that provides the drag-and-drop functionality for
transferring items between Sortable components within the same page.

activeDraggable DraggableDirective

Specifies the Draggable item that is currently being moved.

lastDraggable DraggableDirective

Specifies the Draggable item that last emitted an event.

originDraggable DraggableDirective

Specifies the Draggable item from which the dragging started.

target SortableComponent

Specifies the SortableComponent instance under the currently dragged item.

Constructors

SortableService (ngZone: NgZone)

Parameters

ngZone NgZone

Methods

getSortableComponentFromTouch

The method that finds the SortableComponent which is registered to
the SortableService by using the arguments of the touch event.

Parameters

touch any

A Touch-Object of the Touch type interface.
Represents a single contact point (finger or stylus)
on a touch-sensitive device (touchscreen or trackpad).

Returns

{ component: SortableComponent; index: number; } - An object
where the component is the SortableComponent that owns the item
and the index is the index of the touched item.

getSource

Returns the source SortableComponent from which
an item is dragged to other Sortable components.

Returns

SortableComponent - The SourceComponent.

registerComponent

Registers a SortableComponent with which the service operates.

Parameters

sortableComponent SortableComponent

The SortableComponent.

Returns

string - The unique key that the current SortableComponent gets when registered.

setSource

Sets the SortableComponent as a source component. When dragging an item from one Sortable to another,
the source component is the one from which the item originates.

Parameters

sortable SortableComponent

The SortableComponent.

unregisterComponent

Removes a SortableComponent from the registered SortableComponents with which the service operates.

Parameters

key string

The key of the SortableComponent which will be removed from the register.
Obtained when registerComponent is called.