Reputation: 3700
I am trying to implement angular2-tree in my application, and its work great but when i try to add filter i am not able to figure out how to get the tree object which is used for filter.
here is link for angular2-tree docs https://angular2-tree.readme.io/docs/filtering
here is my html
<input #filter (keyup)="filterNodes(filter.value, tree)" placeholder="filter nodes" />
<Tree (onMoveNode)="onMoveNode($event)" [nodes]="nodes" [options]="customTemplateStringOptions"></Tree>
here is my ts code for filter
filterNodes(text, tree) {
tree.treeModel.filterNodes("text", true);
};
but i am not able to get the tree object
Upvotes: 0
Views: 1769
Reputation: 7476
<input #filter (keyup)="filterNodes(filter.value, tree)" placeholder="filter nodes" />
<Tree #tree (onMoveNode)="onMoveNode($event)" [nodes]="nodes" [options]="customTemplateStringOptions"></Tree>
In you component code:
@ViewChild('tree') tree: any;
And then it should be defined in the component
Let me know if it solved your issue
Upvotes: 1