I have a JSON object as follows:
{"email":null,"fullList":true,"listOfSomething":[
{
"contactEmailAddress": "[email protected]",
"somethingId": 11060767,
"other": "whatever"
},
{
"contactEmailAddress": "[email protected]",
"somethingId": 8499447,
"other": "whatever"
}, {
"contactEmailAddress": "[email protected]",
"somethingId": 3234664,
"other": "whatever"
}, {
"contactEmailAddress": "[email protected]",
"somethingId": 3233245,
"other": "whatever"
}
]
,"numOfResults":22}
In angular, I want to filter this list by an array of selected ID's, to match the key "SomethingID", within the key "listOfSomething"
My array of ID's to match against is formatted as:
[16199615,16199619]
My current filter just returns the entire list, unfiltered:
.filter('somethingFilter', ['somethingListService', function(somethingListService) {
domainsSelected = somethingListService.getSomethingSelected();
return function(array) {
return array.filter(function(item) {
return somethingSelected.indexOf(item.somethingId) === -1;
});
};
}]);
I've tried so many different methods, but can find no examples where an array of numbers is matched against a nested JSON object, that has no numeric indexing.