问题
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:
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"
来源:https://stackoverflow.com/questions/51870645/angular-tree-control-filter-the-nodes-of-a-tree