angular-filter icon indicating copy to clipboard operation
angular-filter copied to clipboard

filterBy not distinguish positive and negative number

Open dmiorandi opened this issue 9 years ago • 1 comments

Considering this code

block in orderjson.Blocks | filterBy: ['ID_Block']: block_NM.ID_Block

if ID_Block have on array values [1, -1,3,5] and filter is set to 1. I expect to print just first value, but filter print also -1 because comparision consider 1,-1 the same.

On the flipside of the coin, using only positive values it works fine (no duplicates).

dmiorandi avatar Aug 18 '15 13:08 dmiorandi

#165 was just merged - this adds a strict option to filterBy. That should cover this use case. The issue is that numbers are coerced to strings for search purposes. Without strict, search strings are tested withcontains. Since -1 contains 1, it counts as a match.

toddbranch avatar Nov 17 '15 17:11 toddbranch