Mahajan344 Mahajan344 - 11 months ago 45
AngularJS Question

issue with $filter in angularjs not working with exact search

I am using angularjs

to filter data based upon
Its searching for partial of

Eg. I have array of 3 objects and in all three objects there is
field having values 4105,41,4159 respectively.

Now when I use filter to filter data based upon
Id = 41
. Its returning 1st object which is having value 4105.

I am using filter as below

var filteredData = $filter('filter')($, { Id: userid });

It should return object with value 41 as that what I filter for?

Answer Source
 You shoud add which comparator u want exact or any.
 $filter('filter')(array, expression, comparator, anyPropertyKey)