I have an array with the name of sports, json:
[
{
"id": 26,
"name": "LIVE Betting",
"priority": 0,
"leagues": []
},
{
"id": 8,
"name": "NBA",
"priority": 3,
"leagues": [
{
"id": 5932,
"parent": 1000,
"name": "NBA",
"sport": {
"id": 8,
"name": "NBA"
},
"lineType": "G",
"priority": [
1,
3
],
"part": "0"
}
]
},
{
"id": 24,
"name": "College Basketball",
"priority": 4,
"leagues": [
{
"id": 2599,
"parent": 1000,
"name": "NCAA BASKETBALL",
"sport": {
"id": 24,
"name": "College Basketball"
},
"lineType": "G",
"priority": [
0,
4
],
"part": "0"
},
{
"id": 2631,
"parent": 1000,
"name": "NCAA BASKETBALL ADDED GAMES",
"sport": {
"id": 24,
"name": "College Basketball"
},
"lineType": "G",
"priority": [
1,
4
],
"part": "0"
},
...
within that array you can see another with the name of "leagues": [{...}] which contains an object, my filter is searching fine thru the top array which is sports but once I try to find thru the "name" within leagues array then my app shows up a message that the filter is empty.
<input type="search" ng-model="query">
<div ng-repeat="sport in sportsFilter = (sports | filter:query)">
<!--this array works fine-->
<strong>{{sport.name}}</strong>
</div>
<div ng-repeat="league in sport.leagues">
<!--this one not works at all-->
{{league.name}}
</div>
</div>
I've been trying all the ways already, with a resolve, with different models, etc and actually I just realized that I need a custom filter so I would like you to give me a hand because I do not where to start from with it.
or is there any easier way ?
queryto search objects inleaguesarray? Do you want to match any property ofleagues?ng-repeat="league in sport.leagues | filter: {leagues: {name: query}}and still not working,also remember that I have 2ng-repeatworking with the sameng-model='query'ng-repeat="sport in sportsFilter = ( sports | filter: {leagues: [{name:query}]} )"but now my issue is with thesportsarray, I need to do something like:ng-repeat="sport in sportsFilter = ( sports | filter: {leagues: [{name:query}]} | filter:query)"but still not working