AngularJS Filter Exact Match

前端 未结 3 1101
臣服心动
臣服心动 2020-12-02 21:58

I need to filter a list of items by their category. I want the user to be able to click a button, and then have the filter applied to a list.

At the moment, I have t

3条回答
  •  北荒
    北荒 (楼主)
    2020-12-02 22:38

    In case someone wants to use the filter on the JavaScript side you can do it like:

    $scope.filtered = $filter('filter')($scope.movieList, { genre.name: filters.genre}, true);
    

    Notice the true at the end... it indicates that is to search for the exact match.

提交回复
热议问题