The data entry that the node is visualizing.
Emitted when the node's expanded
property changes.
<igx-tree>
<igx-tree-node *ngFor="let node of data" [data]="node" [(expanded)]="node.expanded">
</igx-tree-node>
</igx-tree>
const node: IgxTreeNode<any> = this.tree.findNodes(data[0])[0];
node.expandedChange.pipe(takeUntil(this.destroy$)).subscribe((e: boolean) => console.log("Node expansion state changed to ", e))
To be used for load-on-demand scenarios in order to specify whether the node is loading data.
Emitted when the node's selected
property changes.
<igx-tree>
<igx-tree-node *ngFor="let node of data" [data]="node" [(selected)]="node.selected">
</igx-tree-node>
</igx-tree>
const node: IgxTreeNode<any> = this.tree.findNodes(data[0])[0];
node.selectedChange.pipe(takeUntil(this.destroy$)).subscribe((e: boolean) => console.log("Node selection changed to ", e))
Gets/Sets the active state of the node
Return the child nodes of the node (if any)
Gets/Sets the disabled state of the node
Get/set whether the node is expanded
<igx-tree>
...
<igx-tree-node *ngFor="let node of data" [expanded]="node.name === this.expandedNode">
{{ node.label }}
</igx-tree-node>
</igx-tree>
const node: IgxTreeNode<any> = this.tree.findNodes(data[0])[0];
const expanded = node.expanded;
node.expanded = true;
The depth of the node, relative to the root
<igx-tree>
...
<igx-tree-node #node>
My level is {{ node.level }}
</igx-tree-node>
</igx-tree>
const node: IgxTreeNode<any> = this.tree.findNodes(data[12])[0];
const level: number = node.level;
Retrieves the full path to the node incuding itself
const node: IgxTreeNode<any> = this.tree.findNodes(data[0])[0];
const path: IgxTreeNode<any>[] = node.path;
An accessor that returns the resource strings.
Gets/Sets the resource strings.
Get/set whether the node is selected. Supporst two-way binding.
<igx-tree>
...
<igx-tree-node *ngFor="let node of data" [(selected)]="node.selected">
{{ node.label }}
</igx-tree-node>
</igx-tree>
const node: IgxTreeNode<any> = this.tree.findNodes(data[0])[0];
const selected = node.selected;
node.selected = true;
Collapses the node, triggering animation
<igx-tree>
<igx-tree-node #node>My Node</igx-tree-node>
</igx-tree>
<button type="button" igxButton (click)="node.collapse()">Collapse Node</button>
const myNode: IgxTreeNode<any> = this.tree.findNodes(data[0])[0];
myNode.collapse();
Toggles the node expansion state, triggering animation
<igx-tree>
<igx-tree-node #node>My Node</igx-tree-node>
</igx-tree>
<button type="button" igxButton (click)="node.toggle()">Toggle Node</button>
const myNode: IgxTreeNode<any> = this.tree.findNodes(data[0])[0];
myNode.toggle();
The tree node component represents a child node of the tree component or another tree node. Usage: