0

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.

JSBin

Whenever a value is selected from the dropdown, you will see the console log $scope.selectedValue. Is there a way I can pass this to the search input (with an ng-model="searchBar")?

Thanks in advance.

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

1 Answer 1

3

Just add another filter with the pipe. Like:

ng-repeat="movie in movies | filter:searchBar | filter: selectedGenre | orderBy:sortType:sortReverse"
Sign up to request clarification or add additional context in comments.

1 Comment

Perfect! Thank you!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.