-
Notifications
You must be signed in to change notification settings - Fork 27.5k
fix(filter): filter on false properties #3597
Conversation
Thanks for the PR!
If you need to make changes to your pull request, you can update the commit with Thanks again for your help! |
Real name: Thomas Dunstan |
@@ -183,7 +183,7 @@ function filterFilter() { | |||
})(); | |||
} else { | |||
(function() { | |||
if (!expression[key]) return; | |||
if (typeof(expression[key]) === undefined) { return; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typeof
returns a string so this comparison is never true. Use typeof expression[key] === 'undefined'
. You should also include one item where the property is not defined in the test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops! Also, how weird that it wasn't picked up by any other tests. I'll remedy that, too.
Code was evaluating !expression[key] while attempting to see if the key was present, but this was evaluating to true for false values as well as missing keys. Closes angular#2797.
Thanks for merging! Now I can upgrade off of 1.0.x. |
use only one IIFE and a ternary op in it, instead of invoking separate IIFEs in if-else (this also completely fixed the same issue closed by PR angular#3597) also add a spec to verify usage of '$' property in expression object (e.g. `{$: 'a'}`)
- use only one IIFE and a ternary op in it, instead of invoking separate IIFEs in if-else (this also completely fixed the same issue closed by PR angular#3597) - also add a spec to verify usage of '$' property in expression object (e.g. `{$: 'a'}`)
- use only one IIFE and a ternary op in it, instead of invoking separate IIFEs in if-else (this also completely fixed the same issue closed by PR angular#3597) - also add a spec to verify usage of '$' property in expression object (e.g. `{$: 'a'}`)
- use only one IIFE and a ternary op in it, instead of invoking separate IIFEs in if-else (this also completely fixed the same issue closed by PR angular#3597) - also add a spec to verify usage of '$' property in expression object (e.g. `{$: 'a'}`) Closes angular#5637
- use only one IIFE and a ternary op in it, instead of invoking separate IIFEs in if-else (this also completely fixed the same issue closed by PR angular#3597) - also add a spec to verify usage of '$' property in expression object (e.g. `{$: 'a'}`) Closes angular#5637
Code was evaluating !expression[key] while attempting to
see if the key was present, but this was evaluating to true for
false values as well as missing keys.
Closes #2797.