i want to search for a string in my array. My Problem ist that my array is really big and has many nested arrays.
It look like this:
[
{
"Id":null,
"Text":"Marketing",
"Gruppen":[
{
"Id":null,
"Text":"Werbeartikel",
"Gruppen":[
{
"Id":null,
"Text":"Werbegeschenk Hobby, Freizeit",
"Gruppen":[
{
"Id":"51004839",
"Text":"Taschenmesser (Werbeartikel)",
"Gruppen":null
},
{
"Id":"51004843",
"Text":"Schirm (Werbeartikel)",
"Gruppen":null
},
{
"Id":"51004845",
"Text":"Sportartikel (Werbeartikel)",
"Gruppen":null
}
]
}
]
}
]
}
]
Now i want to search for (Taschenmesser). i only need to look up all "Text" fields.
I dont know how to do this. I want to get the result as:,
{
"Id":"51004839",
"Text":"Taschenmesser (Werbeartikel)",
"Gruppen":null
}
Here is the Method i search with. But it dont search for nested nested nested arrays:
$scope.SearchForGroup = function (pSearchText) {
var lGruppe = $filter('filter')($scope.WarenGruppenResponse.WarenGruppe, "Schirm")
};
here is plunker demonstrating the problem http://plnkr.co/edit/l0cnZQPAh2HXLX1yTnLl?p=info