Angularjs 对同一ng型号有多个过滤器

Angularjs 对同一ng型号有多个过滤器,angularjs,Angularjs,我有一个ng repeat中的对象数组,我希望对其进行过滤 %input{type: 'text', 'ng-show' => "content == 'include'", 'ng-model' => "search.author"} %input{type: 'text', 'ng-show' => "content == 'exclude'", 'ng-model' => "search.author"} %tr{'ng-repeat' => 'book i

我有一个ng repeat中的对象数组,我希望对其进行过滤

%input{type: 'text', 'ng-show' => "content == 'include'", 'ng-model' => "search.author"}
%input{type: 'text', 'ng-show' => "content == 'exclude'", 'ng-model' => "search.author"}

%tr{'ng-repeat' => 'book in books| filter:search'}
第一个输入过滤器正确过滤与输入字符串匹配的作者,但对于第二个输入,我希望以不同的方式过滤模型,例如:过滤与字符串输入匹配的作者


如何将正确的过滤器从输入传递到ng repeat,以便它知道如何根据输入正确过滤我的集合

我将在作用域上创建一个自定义过滤器,以返回所需内容

$scope.myFilter = function(item) {
if(content == 'include')
//filter one way
else
//filter another way
};


%tr{'ng-repeat' => 'book in books| filter:myFilter '}

在这种情况下,筛选器如何知道ng show值?您可以将其设置为if、constraintSo,在这种情况下,include和exclude不是与author对象关联的属性。它们只是任意字符串,用于标识我希望以不同方式过滤两个相同的输入,因此一个将像filter:search一样过滤,另一个将像filter:一样过滤!搜索