a simple and effective way that can solve every problem it just tricky way but can help you out. it will handle everything null, undefined, (''),false`
just do this
<span ng-repeat="entry in ctrl.array | filter:!!entry.value ">{{entry.name}} </span>
working plunkr
script.js
(function(angular) {
'use strict';
angular.module('FilterInControllerModule', []).
controller('FilterController', ['filterFilter', function(filterFilter) {
this.array = [{
"name": "name1",
"value": null
}, {
"name": "name2",
"value": 3
}, {
"name": "name3",
"value": false
}, {
"name": "name4",
"value": undefined
}, {
"name": "name5",
"value": "some text"
}];
}]);
})(window.angular);
can also use custom filter ..
.filter('customFilter',function(){
return function(val,input){
var result =[];
angular.forEach(val,function(res){
if(res.value && res.value.length || res.value){
result.push(res);
}
});
return result;
}
})
index.html
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Example - example-example29-production</title>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular.min.js"></script>
<script src="script.js"></script>
</head>
<body ng-app="FilterInControllerModule">
<div ng-controller="FilterController as ctrl">
<div>
All entries:
<span ng-repeat="entry in ctrl.array | filter:!!entry.value ">{{entry.name}} </span>
</div>
<div>
</div>
</div>
</body>
</html>
if you want to keep like your code you can simply do this.
data = $filter('filter')(data, {
value: !!value
});