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.

1 Answer 1

1

Yes, you can pass an object into filter expression:

filter:{name:name}
Sign up to request clarification or add additional context in comments.

1 Comment

@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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.