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

Filter : issue when some properties are null (deep object filter) #10991

Closed
ElephantRose opened this issue Feb 6, 2015 · 1 comment
Closed

Comments

@ElephantRose
Copy link
Contributor

When using filter (filterFilter function) with deep object and optional properties (means nullable), filter throws an error "TypeError: Cannot read property 'x' of null '
I believe that a null value property check is missing when dealing with object
By the way the orderBy filter is not concerned by this issue.

I solved it in my project by replacing the following line in the deepCompare function used by filterFilter function.

var actualVal = matchAnyProperty ? actual : actual[key];

with

var actualVal = (matchAnyProperty || actual == null) ? actual : actual[key];

The issue is on actual[key]

Angular version : 1.3.12
Reproducible: Always
Jsfiddle : http://jsfiddle.net/k25y4bg2/

ElephantRose added a commit to ElephantRose/angular.js that referenced this issue Feb 6, 2015
Solve case : angular#10991
with using filter and deep object
@gkalpak
Copy link
Member

gkalpak commented Feb 6, 2015

This is a valid issue. I have left a comment on what I consider to be an appropriate fix at #10992 (comment)

@gkalpak gkalpak self-assigned this Feb 6, 2015
@gkalpak gkalpak added this to the Backlog milestone Feb 6, 2015
ElephantRose added a commit to ElephantRose/angular.js that referenced this issue Feb 17, 2015
Regarding the issue angular#10991 and the following discussion angular#10992
Solve issue with null property value when using objects with filter.
ElephantRose added a commit to ElephantRose/angular.js that referenced this issue Feb 19, 2015
fix(filterFilter): solve issue angular#10991 with null property value when using objects with filter : test
ElephantRose added a commit to ElephantRose/angular.js that referenced this issue Feb 19, 2015
… when using objects with filter

fix(filterFilter): solve issue angular#10991 with null property value when using objects with filter

Regarding the issue angular#10991 and the following discussion angular#10992
petebacondarwin pushed a commit that referenced this issue Feb 27, 2015
netman92 pushed a commit to netman92/angular.js that referenced this issue Aug 8, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants