This repository was archived by the owner on Apr 12, 2024. It is now read-only.
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
Description
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/