As filters provided by AngularJS only work with arrays but not with objects, i'm using the filter function suggested in this solution.
Now i want to extend it, because my json data additionally has a settings-object storing the visibility data for the filtering (unfortunately i can not modify the json structure):
$scope.data = {
"groups":{
"1": {
"type": "foo",
"name": "blah",
"settings": {
"visibility":[true]
}
},
"2": {
"type": "bar",
"settings": {
"visibility":[false]
}
}
}
}
Therefore also my filter call is more complex, 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>
Probably
objectByKeyValFilter:'settings.visibility[0]' : true
becomes wrongly something like that
myObject['settings.visibility[0]']
How can i modify the filter function in order to achieve the filtering?
Not working Plunker: http://plnkr.co/edit/f202lA?p=preview