Track by specific fields in AngularJs

In an Angularjs/Ionic project I have a search input. When I search for something e.g ‘search’ a get request is made to an internal api and it returns an array of objects. In the same time the search resutls are filtered based on the search. The problem is that I want to get results only when the property firstName matches with ‘search’ (or it is included) and NOT when an other property e.g. address includes ‘search’. This is what is happening now.

The code

E.g GENOLLI ILIR appears because it includes ‘ta’ in their address property and NOT in their firstName an example

Thanks a lot!


ng-repeat="pat in patients | filter:{}"

Leave a Reply

Your email address will not be published. Required fields are marked *