I'm currently working on developing a customized angular filter that will be based on an array of strings. For instance:
$scope.idArray = ['1195986','1195987','1195988']
The data that I aim to filter is structured as follows:
$scope.data = {
"moduleName": null,
"contentholder_0": {
"moduleName": "contentholder",
"id": "-1",
"name": "",
"content": ""
},
"webapps_1": {
"moduleName": "webapps",
"items": [{
"itemid": "1195986",
"name": "abc"
},{
"itemid": "1195987",
"name": "def"
},{
"itemid": "1195988",
"name": "ghi"
}]
}
}
In my quest to create this custom filter, I referenced a similar query on Stack Overflow: Example
You can find the answer in this JSFiddle link.
Despite my efforts, I have struggled to adapt it to suit my specific data structure - filtering the "items" based on whether their "itemid" matches an entry in "idArray."
Here's a JSfiddle that's as close as I could get without causing Angular to crash.
I apologize if this appears to be a simple question; being a novice, I've made numerous attempts at resolving it without success. I'm uncertain about where the actual filtering occurs and how to compare the strings in idArray with data.webapps_1.items.itemid
Your assistance would be greatly appreciated.