Since the filters provided by AngularJS only work with arrays, but not with objects, I use the filter function proposed in this solution .
Now I want to expand it, because my json data additionally has an object object that stores visibility data for filtering (unfortunately, I cannot change the json structure):
$scope.data = {
"groups":{
"1": {
"type": "foo",
"name": "blah",
"settings": {
"visibility":[true]
}
},
"2": {
"type": "bar",
"settings": {
"visibility":[false]
}
}
}
}
Therefore, my filter call is more complicated, but, of course, does not work with the filter at the moment:
<div ng-repeat="(key, value) in data.groups | objectByKeyValFilter:'settings.visible[0]':true>
{{key}} {{value.type}}
</div>
maybe
objectByKeyValFilter:'settings.visibility[0]' : true
something like this becomes erroneous
myObject['settings.visibility[0]']
How can I change the filter function to achieve filtering?
Plunker does not work: http://plnkr.co/edit/f202lA?p=preview