-
Notifications
You must be signed in to change notification settings - Fork 27.4k
ng-repeat fails to show items when filter text is null (1.3.15) #11573
Comments
I believe that it was fixed in master via b5002ab. @gkalpak @petebacondarwin shell we back-port it to 1.3.x? |
Since this is a regression introduced in 1.3.15, I think it should be back-ported. |
Included fixes: * Do not convert `null`/`undefined` to strings for substring matching in non-strict comparison mode. Prevents `null`/`undefined` from being matched against e.g. 'u'. * Let `null` (as a top-level filter expression) match "deeply" (as do booleans, numbers and strings). E.g. let `filterFilter(arr, null)` match an item like `{someProp: null}`. Fixes angular#11573
Thanks @gkalpak - I think that closes this issue. |
@petebacondarwin, I have submitted the PR, but it isn't merged yet. (So, technically this isn't solved (yet).) |
Thanks all for looking into this. Much appreciated! |
Included fixes: * Do not convert `null`/`undefined` to strings for substring matching in non-strict comparison mode. Prevents `null`/`undefined` from being matched against e.g. 'u'. * Let `null` (as a top-level filter expression) match "deeply" (as do booleans, numbers and strings). E.g. let `filterFilter(arr, null)` match an item like `{someProp: null}`. Fixes #11573 Closes #11617
@gkalpak How can I do "not null" check in this way?
in the 1.3.15 |
@issoft-nsiniakevich, I am afraid you should either use |
Also worth noting that I have been tracking this ability in an SO answer. You can see there that this has changed over the different versions and while it appears that |
Hi dear ang developers! $filter('filter')(array, {property: "!null"}) or |
It seems that |
To expand a bit on what @petebacondarwin said: In the current version (which hasn't changed iirc since 1.4.x), const expr = {foo: ''};
filterFilter([{foo: 'bar'}, {foo: true}, {foo: 1}], expr) //--> All match
filterFilter([{foo: null}, {foo: undefined}, {foo: {}}], expr) //--> No match
const expr = {foo: '!'};
filterFilter([{foo: 'bar'}, {foo: true}, {foo: 1}], expr) //--> No match
filterFilter([{foo: null}, {foo: undefined}, {foo: {}}], expr) //--> All match *: Objects with a custom |
Upgraded to 1.3.15 today in one of my apps and found that an ng-repeat option list with a filter no longer displayed any items. It appears the problem is due to the fact the initial string filter value is null - if I change the initial value to an empty string it works.
Then in the HTML to bind:
If the intial value of searchText is null the list will not display any items. If the initial value is an empty string (""), however it works fine. This is a breaking change from 1.3.14 where this worked. If by design this should probably go into the breaking change list.
However I think null should be treated like an empty string for search filters I believe so I'd call this a bug...
The text was updated successfully, but these errors were encountered: