传递动态搜索参数以在AngularJs中过滤

时间:2017-08-12 21:42:10

标签: angularjs json angularjs-filter

我对Movie json有不同的过滤条件。 例如,如果它的类型是'它是:

filter: {'year' : search} 

或者'年'它将是:

$scope.$watch('search', function(search) {
    filteredmovies = filterFilter(_.values(movies), search);
    $scope.PaginationService.TotalItems = _.size(filteredmovies);
});

但是由于我正在使用分页和整体搜索,我在我的控制器中调用filter作为服务,如下所示:

<ListView ItemsSource="{Binding Items}"
        ItemTapped="Handle_ItemTapped"
        CachingStrategy="RecycleElement">

  <!--Built in Cells-->
  <ListView.ItemTemplate>
    <DataTemplate>
      <TextCell />
    </DataTemplate>
  </ListView.ItemTemplate>
</ListView>

&#39;搜索&#39;是我在文本框上的ng模型。以上行进行整体搜索(不是基于密钥的)。现在我很困惑如何搜索特定的关键属性,例如&#39; genre&#39;和&#39;年&#39;在电影上,使用此函数filterFilter,因为用户可以选择他们想要绑定搜索的属性。

0 个答案:

没有答案
相关问题