When I filter an array of object with a number something like:
$scope.users = [{name:'John', id:-1},
{name:'Mary', id:1},
{name:'Mike', id:2},
{name:'Adam', id:3}];
var selected = $filter('filter')($scope.users, {id: $scope.target});
If target = 1, the selected result will include John and Mary. But I only want the exactly same id which is Mary with id 1 to be included. Why does it include negative numbers? How can I prevent that?