angularjs - Custom Filter not firing in angular1 -
i have 2 fields in digest: genres
, secondary_genre
integers.
i have dropdown fields of genres returns value (ng-model = query.genres)
i have tried create custom function compare genre , secondary genre query.genre , return if either condition met. individually work fine i.e filter:{secondary_genre:query.genre) or condition need custom.
the custom filter have written called with
<li ng-repeat="film in listoftitles | customgenrefilter:query.genre">
the filter is
.filter('customgenrefilter', function() { return function(data, query) { if (data) { return data.filter(data.genres == query || data.secondary_genre == query); } else { return []; } }; });
but throwing errors. how can write custom filter return item if condition genres = query.genre or secondary_genre = query.genre.
query.genre
object like? havequery.genre.genres
? – jarek kulikowski jul 28 @ 15:10