Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

filterBy with boolean field is not working for me #250

Open
germanger opened this issue May 2, 2017 · 1 comment
Open

filterBy with boolean field is not working for me #250

germanger opened this issue May 2, 2017 · 1 comment

Comments

@germanger
Copy link

$scope.users = [
  { id: 1, first_name: 'Rob', last_name: 'John',  mobile: 4444, isFoo: false },
  { id: 2, first_name: 'John', last_name: 'Wayne',  mobile: 3333, isFoo: false },
  { id: 3, first_name: 'Rob', last_name: 'Johansson',  mobile: 2222, isFoo: false },
  { id: 4, first_name: 'Mike', last_name: 'Terry',  mobile: 1111, isFoo: true }
];

Return users whose isFoo is true:

<!--search only by id -->
<th ng-repeat="user in users | filterBy: ['isFoo']: true">
  {{ user.id }} : {{ user.first_name }} {{ user.last_name }}
</th>

Result:

All users... why?
@Nineapsofttech
Copy link

Nineapsofttech commented Mar 20, 2018

You can use Pick or Omit for filter some variable .
in your case should be

user in users | pick:'isFoo'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants