Skip to content

NgDiagramSelectionService

since v0.8.0

The NgDiagramSelectionService provides methods for managing the selection state of nodes and edges in the diagram.

private selectionService = inject(NgDiagramSelectionService);
// Select nodes and edges
this.selectionService.select(['nodeId1'], ['edgeId1']);
  • NgDiagramBaseService

selection: Signal<{ edges: Edge<object>[]; nodes: Node[]; }>

Returns a computed signal for the current selection of nodes and edges.

deleteSelection(): Promise<void>

Deletes the current selection of nodes and edges.

Promise<void>

A promise that resolves once the change has been applied to the model. Inside a transaction, the promise resolves right away and the change is applied when the transaction commits.


deselect(nodeIds, edgeIds): Promise<void>

Deselects nodes and edges by their IDs.

string[] = []

Array of node IDs to deselect.

string[] = []

Array of edge IDs to deselect.

Promise<void>

A promise that resolves once the change has been applied to the model. Inside a transaction, the promise resolves right away and the change is applied when the transaction commits.


deselectAll(): Promise<void>

Deselects all currently selected nodes and edges.

Promise<void>

A promise that resolves once the change has been applied to the model. Inside a transaction, the promise resolves right away and the change is applied when the transaction commits.


select(nodeIds, edgeIds): Promise<void>

Selects nodes and edges by their IDs.

string[] = []

Array of node IDs to select.

string[] = []

Array of edge IDs to select.

Promise<void>

A promise that resolves once the change has been applied to the model. Inside a transaction, the promise resolves right away and the change is applied when the transaction commits.