Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

filter: search in a specific field (array) return a list different that the initial state when i clear my filter #14608

Closed
jean-alain-re opened this issue May 13, 2016 · 1 comment

Comments

@jean-alain-re
Copy link

I filter from an input an array on a specific field.This field is an array. Sometimes, i have values, sometimes not.
The initial state, I see all items of this array. I type something in the input, the filter filters the field which expects with the input. When my input is empty, it shows all items where the field isn't empty.

I'm expected to get the same behaviour when I initialize my application.

http://plnkr.co/edit/d99r5yPDEKqmGIGM8OqP?p=preview

I found a workaround to set the filtered field to undefined when the input is empty

http://plnkr.co/edit/nG951XNg43tUcj0IkRvN?p=preview

@gkalpak
Copy link
Member

gkalpak commented May 13, 2016

This is expected behavior. It happens because initially the expression is undefined, but when you clear the field it is an empty string (and filtering with undefined behaves differently than filtering with the empty string).
See #12060 for more context and possible work-arounds.

@gkalpak gkalpak closed this as completed May 13, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants