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
| Name | Description |
|---|---|
_selectedItem$: BehaviorSubject<SelectedItem | null> | Internal subject holding the currently selected item. |
Methods
| Name | Parameters | Returns | Description |
|---|---|---|---|
selectedItem$ | - | Observable<SelectedItem | null> | Observable emitting the currently selected item. |
selectItem | itemId: string, element?: HTMLElement | void | Marks an item as selected. |
clearSelection | - | void | Clears the current selection. |
getCurrentSelection | - | SelectedItem | null | Returns the currently selected item synchronously. |
Types
export interface SelectedItem {
itemId: string;
element?: HTMLElement;
}
See Also
- Abstract Item Actions Directive - Provides base functionality for item actions.
- Action Menu Directive - Attaches an action menu to an item.