Jose Jose - 1 year ago 66
AngularJS Question

AngularJS: Filtering results with two parameters taken from inputs

I have this simple Angular app which displays movies in table format and has a search input and dropdown (select element) with genre values to filter/search results. I am trying to figure out how I can filter my results by both terms typed into the search input AND the dropdown.


Whenever a value is selected from the dropdown, you will see the console log

. Is there a way I can pass this to the search input (with an

Thanks in advance.

EDIT: Basically, I want to be able to filter my results by Genre if need be.

Answer Source

Just add another filter with the pipe. Like:

ng-repeat="movie in movies | filter:searchBar | filter: selectedGenre | orderBy:sortType:sortReverse"
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download