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 does not work with empty string #7890
Closed
Description
$scope.persons = [
{
firstName: 'Nicolas',
lastName: 'John'
},
{
firstName: 'Julien',
lastName: 'Smith'
},
{
firstName: 'Thomas',
lastName: ''
}
];
// WORKS, returns item {firstName:'Thomas', lastName:''}
$scope.thomasFilter = $filter('filter')($scope.persons, {firstName: 'Thomas'});
// FAILS, returns the entire array instead of {firstName:'Thomas', lastName:''}
$scope.emptyStringFilter = $filter('filter')($scope.persons, {lastName: ''});
See demo: http://plnkr.co/edit/D9zi5h?p=preview
Tested with AngularJS 1.2.18 and 1.3.0-beta.13