<div ng-repeat="translator in users | filter : { languages : '!!' }">
Explanation:
Consider a list as below:
$scope.items = [
{
propertyOne: 'a',
propertyTwo: 'hello'
},
{
propertyOne: 'b',
propertyTwo: null
},
{
propertyOne: 'c',
propertyTwo: undefined
},
{
propertyOne: 'd'
}
];
'!!'
filters out objects having a certain property or objects having a certain property that is not undefined or null:
<div ng-repeat="item in items | filter : { propertyTwo : '!!' }">
{{item.propertyOne}}
</div>
<!-- outputs: a -->
'!'
filters out objects not having certain property or objects having a certain property that is undefined or null:
<div ng-repeat="item in items | filter : { propertyTwo : '!' }">
{{item.propertyOne}}
</div>
<!-- outputs: b c d -->
Plnkr
Note: It does not work for properties with values like 0, false or empty string('').
EDIT: previous answer was different from the plunkr example. I fixed them by swapping '!!' and '!'.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…