Angular tree control ---- filter the nodes of a tree

966 views Asked by At

I am following the link https://wix.github.io/angular-tree-control/ to explore different features of angular tree control.From the documentation could not properly understand what values i should give for filter comparator and filter expression to make it work in order to filter the nodes.Below is the code:

<body ng-app="app">
Search: <input ng-model="searchTree">
<table id="searchTextResults">
<tr><th>Name</th><th>Age</th></tr>
<tr ng-repeat="data in dataForTheTree | filter:searchTree">
<td>{{node.name}}</td>
<td>{{node.age}}</td>
</tr>
</table>
<div ng-controller="myController">
<treecontrol class="tree-light"
tree-model="dataForTheTree"
filter-expression="data" 
filter-comparator="false"
options="treeOptions"
on-selection="showSelected(node)"
selected-node="node1">  {{node.name}} age {{node.age}}
</treecontrol>
</div>
</body>

Full link for plunkr : https://plnkr.co/edit/bQHOIQ2HDPr4WJaukB8I?p=preview

1

There are 1 answers

0
Thilan Madusanka On

In here we can use filter-expression it is just like ng-repeat | filter:{} option

filter-expression="{filterable column: ng-model name}"

ex - filter-expression="{name: searchByName}"

and we can use

filter-comparator="true"
filter-comparator="false"