Skip to main content

Item Selection

Overview​

The ItemSelectionService keeps track of the currently selected item in the tree. It is used when items are selected, either via click, double-click, or programmatically by the library.

Import​

import { DndModule } from 'ngx-builder-dnd';

Selector​

ItemSelectionService

API Reference​

Properties​

NameDescription
_selectedItem$: BehaviorSubject<SelectedItem | null>Internal subject holding the currently selected item.

Methods​

NameParametersReturnsDescription
selectedItem$-Observable<SelectedItem | null>Observable emitting the currently selected item.
selectItemitemId: string, element?: HTMLElementvoidMarks an item as selected.
clearSelection-voidClears the current selection.
getCurrentSelection-SelectedItem | nullReturns the currently selected item synchronously.

Types​

export interface SelectedItem {
itemId: string;
element?: HTMLElement;
}

See Also​