角树控制----过滤树的节点 [英] Angular tree control ---- filter the nodes of a tree
问题描述
我正在跟踪链接 https://wix.github.io/angular-tree-control/探索角度树控制的不同功能.从文档中无法正确理解我应该为过滤器比较器和过滤器表达式提供什么值,以使其能够工作以过滤节点.下面是代码:
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>
plunkr的完整链接: https://plnkr.co/edit/bQHOIQ2HDPr4WJaukB8I?p=预览
Full link for plunkr : https://plnkr.co/edit/bQHOIQ2HDPr4WJaukB8I?p=preview
推荐答案
在这里我们可以使用 filter-expression
,就像 ng-repeat |过滤器:{}
选项
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}"
我们可以使用
filter-comparator="true"
filter-comparator="false"
这篇关于角树控制----过滤树的节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!