angularjs - Angular search not filtering properly -
i have list of json data need able filter typing name in. results should display listings have name in result. hiding other names, , still showing of other listings.
how can set filter when type in actors name, shows movie listings actor listed in?
this markup used display listings, angular filter code:
<div class="row" ng-repeat="movies in results | filter:genre"> <div class="col-lg-12"> <div class="well well-sm"> <div class="row"> <div class="col-xs-3 col-md-3 text-center"> <img src="" alt="poster" class="img-rounded img-responsive" /> </div> <div class="col-xs-9 col-md-9 section-box"> <h2> {{movies.name}} </h2> <div class="row rating-desc"> <div class="col-md-12"> <span class="glyphicon glyphicon-time"></span>{{movies.duration}}<span class="separator">|</span> <span class="glyphicon glyphicon-signal"></span>{{movies.rank}}<span class="separator">|</span> <a class="bookmovie" href="http://www.fandango.com/{{movies.name}}">book now!</a> </div> </div> <hr> <p> {{movies.description}} </p> <p ng-repeat="actor in movies.actors | filter:actor" > <span ng-bind="actor"></span> </p> <hr /> </div> </div> </div> </div> </div>
the json , rest of code can seen in plunker: https://plnkr.co/edit/zmxasrg9ir0qlnntoycd?p=preview
thats because should put actor filter in parent ng-repeat, check below plnkr:
https://plnkr.co/edit/k1jvxl0cpxysjhn2tnx7?p=preview
<div class="row" ng-repeat="movies in results | filter:actor | filter:genre">
Comments
Post a Comment