1

I trying to make a filter with AngularJS that filters specific data parts of a scope, for example:

$scope.opdrachten = [
    {"organisation":"Organisation1","number":"7ZDG54","city":"Amsterdam"},
    {"organisation":"Organisation2","number":"9D4F3G","city":"New York"},
    {"organisation":"Organisation3","number":"1AS2S3","city":"Paris"},
    {"organisation":"Organisation4","number":"4A5T7D","city":"Oslo"},
];

This is what i have in my scope to filter, but i only want to filter organisation and number without AngularJS filtering city. I have already managed that Angular only filters organisation but i can't find any documentation that shows me how i can filter multiple sections of the scope.

Here is my Fiddle

1 Answer 1

1

Hello what do you think of this solution : Fiddle

<div style="background:#eee;" ng-repeat="emp in opdrachten | filter:query">

$scope.query = function (emp) {
return emp.organisation.indexOf($scope.queryFilter)!=-1 ||  emp.number.indexOf($scope.queryFilter)!=-1 ;

}

Sign up to request clarification or add additional context in comments.

Comments

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.