角树控制----过滤树的节点

时间:2018-08-16 06:13:48

标签: angularjs treecontrol

我正在跟踪链接https://wix.github.io/angular-tree-control/,以探索角度树控制的不同功能。从文档中无法正确理解为过滤器比较器和过滤器表达式应赋予的值,以使其能够工作以过滤节点代码如下:

<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=preview

1 个答案:

答案 0 :(得分:0)

在这里我们可以使用filter-expression就像ng-repeat | filter:{}选项

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

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

我们可以使用

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