0
这里是我的数据:“包含”搜索对象数组的子元素
[
{profile: {name: "Test123"}}
]
我有一个文本输入,就像这样:
<input ng-model="searchText">
我试图做一个使用文本框输入搜索profile.name
。
我试图做一个自定义过滤器,像这样:
$scope.searchFilter = function(value){
return value.profile.name.indexOf($scope.searchText) != -1;
};
然后过滤,像这样:
<tr ng-repeat="profile in profiles | filter: searchFilter"></tr>
似乎不幸的是,这工作正常的初始搜索,但进入时文本放入文本框中,过滤器不会被重新评估。
当我在搜索框中输入文字时,如何强制Angular重新检查过滤器,还是有更好的方法来做到这一点?