Skip to content Skip to sidebar Skip to footer

Angular Filter For Specific Properties In An Array

I have an angular filter by input text. for the given list initialViewModel.users = [ {user: 'Nithin',phone: 'Azus', price: 13000}, {user: 'Saritha',phone: 'MotoG1',price: 12000

Solution 1:

By default angular filters by any property of an object. If you want to filter by specific property you need to update your filter:

<li ng-repeat="user in Model.users | filter: { user: Model.name } | orderBy:'price'">
    {{user.user + ' bought phone worth ' + user.price}}
</li>

Pay attention to this part: filter: { user: Model.name }. In this case you are telling angular to filter only property user of your object.

Here is an updated JSFiddle

Post a Comment for "Angular Filter For Specific Properties In An Array"