I am in need of a filter logic similar to the one used in the example posted on this older post, but tailored for a more recent version of Angular.
The filtering example provided in the older post seems to fit my requirements perfectly, especially with nested JSON objects that are 4 levels deep. However, I am struggling to implement the same functionality in my Angular 8 solution.
This is how my data structure looks:
[{
"name": "Repair Category Name",
"image": "https://via.placeholder.com/150",
"subCategories": [
{
"name": "Repair SubCategory Name 1",
"image": "https://via.placeholder.com/150",
"selectorOptions": [
{
"name": "Repair Selector Option 1",
"image": "https://via.placeholder.com/150",
"repairItems": [
{
"name": "Repair Item 1",
"image": "https://via.placeholder.com/150",
"sorCode": "12345"
},
{
"name": "Repair Item 2",
"image": "https://via.placeholder.com/150",
"sorCode": "12345"
}
]
}
]
},
{
"name": "Repair SubCategory Name 2",
"image": "https://via.placeholder.com/150",
"selectorOptions": [
{
"name": "Repair Selector Option 1",
"image": "https://via.placeholder.com/150",
"repairItems": [
{
"name": "Repair Item 1",
"image": "https://via.placeholder.com/150",
"sorCode": "12345"
},
{
"name": "Repair Item 2",
"image": "https://via.placeholder.com/150",
"sorCode": "12345"
}
]
}
]
}
]}]
My goal is to filter by the name or SOR code of the RepairItem and retrieve the complete sub and parent objects to display the results under their respective categories on the UI.
Here is what I have attempted so far: Stackblitz
Any assistance would be highly appreciated!
Thank you