When I enter one word, it looks fine, but if you need to find, for example, by two values, for example Name and Country, then the filter is not looking. I understand that you need to write a custom filter. I rummaged everything I can not understand which way to look
<div class="gradientborder"> <input class="search" type="text" placeholder="$search" ng-model="searchPlayers" > </div> <div class="items" ng-controller="ctrl2"> <div ng-repeat="todo in players | filter:searchPlayers" class="item"> <div class="player-name"> {{todo.name}} </div> <div class="player-info"> id: {{todo.id}}, position: {{todo.position}}, jerseyNumber: {{todo.jerseyNumber}}, dateOfBirth: {{todo.dateOfBirth}}, nationality: {{todo.nationality}}, contractUntil: {{todo.contractUntil}} , <br> marketValue: {{todo.marketValue}} </div> </div> </div> js file below
var SearchApp = angular.module('SearchApp',[]); SearchApp.controller('ctrl2', function($scope, $http) { $http.get('players.json') .then(function(res){ $scope.players = res.data; }); }); Sample data
{ "id":242, "name":"Abdul Rahman Baba", "position":"Left-Back", "jerseyNumber":6, "dateOfBirth":"1994-07-02", "nationality":"Ghana", "contractUntil":"2020-06-30", "marketValue":"10,000,000 " }, { "id":435, "name":"Falcao", "position":"Centre Forward", "jerseyNumber":9, "dateOfBirth":"1986-02-10", "nationality":"Colombia", "contractUntil":"2016-06-30", "marketValue":"35,000,000 " }, Need to find: Abdul Rahman Baba Left-back. you need to search all through one input. Search must find this player here. Either this: Need to find: Left-back England The search should find all England players in the Left-back position