I need to filter a list of items by their category. I want the user to be able to click a button, and then have the filter applied to a list.
At the moment, I have this working to an extent.
Let's say for example I have a list of movies, rendered like so:
<li ng-repeat="movie in movieList | filter:filters">{{ movie.title }}</li>
And I also have a list of movie genres (rendered as buttons, which when clicked will filter the list of movies) rendered like so:
<li ng-repeat="genre in genres">
<a ng-click="filters.genre = genre.name" ng-click='changeGenre(genre.name)'>{{genre.name}}</a>
</li>
(All the 'changeGenre()' function does is update the scope to show which genre is currently being viewed).
Now this works fine up until I have a situation where, say I have the 2 genres: 'Action' and 'Action Adventure'. When I filter by movies with the genre 'Action', I not only get a list of Action movies, but also Action Adventure movies.
Is there a way I can get an exact match using the filter?