0

I have the following code:

<input type="text" ng-model="searchText">
<div ng-repeat="user in student.suggested_users | filter:searchText" ng-init="current_user = getUser(user)">{{current_user.name}}
</div>

This will help me in filtering objects from student.suggested_users array. But i want to filter on the name of the current_user object that is initialized for every user object.

Can anyone help me with this?

1 Answer 1

2

This is an example from my project: https://github.com/lucassus/mongo_browser/blob/master/app/assets/templates/databases.html and explanation how it works: http://jsfiddle.net/pkozlowski_opensource/JtAZM/1/

Basically instead ng-model="filterValue" you should use ng-model="filterValue.{akey}"

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

1 Comment

Thanks luacassus! Do we have an option where we say just filter by name and user_id of the user and not anything else like <input type="text" ng-model="searchText.$(name || user_id)">

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.