TreeModel
How to invoke methods
Get a reference to the treeModel
attribute to access the API.
For example:
<tree-root #tree [nodes]="nodes"></tree-root>
<button (click)="tree.treeModel.focusNextNode()">Next</button>
<button (click)="tree.treeModel.focusPreviousNode()">Prev</button>
Or using a ViewChild
:
import { TreeComponent, TreeModel, TreeNode } from 'angular-tree-component';
class MyComponent {
@ViewChild('tree') treeComponent: TreeComponent;
ngAfterInit() {
const treeModel:TreeModel = this.treeComponent.treeModel;
const firstNode:TreeNode = treeModel.getFirstRoot();
firstNode.setActiveAndVisible();
}
}
Complete API
You can find the complete API of the TreeModel here:
Updated less than a minute ago