JSFiddle - React, Tailwind, and code Playground
HTML
<div ng-app>
<p>As soon as you filter the age "Richard" is removed from the list since age is null on that object. I want to figure out a way to re-include the nulls when the age filter textbox is empty.</p>
<div ng-controller="ListCtrl">
<input type="text" ng-model="search.age" placeholder="Age"></input>
<ul>
<li ng-repeat="item in items | filter:checkAge">
{{item.name}} - {{item.age}}
</li>
</ul>
</div>
<p>I tried popping the age property off the search object, but couldnt get it to work.</p>
</div>
JavaScript
function ListCtrl($scope) {
$scope.items = [
{'name':'Carl', 'age':69},
{'name':'Neil', 'age':54},
{'name':'Richard'},
{'name':'Chris', 'age':58}
];
$scope.checkAge = function(item)
{
if($scope.search && $scope.search.age && $scope.search.age.length > 0)
{
return item.age && item.age.toString().indexOf($scope.search.age) > -1;
}
return true;
}
}