0

here is my controller :

   varDemoApp.controller('SimpleController',function($scope){
        $scope.customers = [{name:'Ahsan',city:'Khulna'},
            {name:'Rokib',city:'Bogra'},
            {name:'Asad',city:'Satkhira'}];

    });

And my html code is :

<div data-ng-controller="SimpleController">
    Name:
    <br/>
    <input type="text" data-ng-model="name"/>
    <ul>
        <li data-ng-repeat="cust in customers|filter:name|orderBy:'name'">
            {{cust.city}}-{{cust.name}}
        </li>
    </ul>
</div>

I want to filtered only by 'customers.name' but now it filter by overall customers array.

Ahsan 02
  • 61
  • 2
  • 15

1 Answers1

1

Yes, you can pass an object into filter expression:

filter:{name:name}
Artem Petrosian
  • 2,964
  • 1
  • 22
  • 30
  • @artem if more than one filter is needed then how will the expression go? will it be `filter:[{name:name},{city:city}]`? I am just a newbie to angular reached here googling – Saurabh Sharma Sep 13 '16 at 13:16