Filter list from similar strings

Asked

Viewed 99 times

0

My question is how do I, using the Angularjs filter, filter items from a list from string attributes. These attributes are similar, 'Relevant' and 'non-relevant'.

<select class="select input" ng-model="classes">
    <option value="rel">relevant</option>
    <option value="non-rel">non-relevant</option>
 </select>
<tbody>
    <tr ng-repeat="post in posts | filter:{classification:classes}">
...

The problem is that when I put in select "Relevant", it brings all. It can only bring specifically if it is the "non-relevant". I wonder if there is a way I return only those that only have "Relevant" or only those that have "non-relevant". How could I solve this problem? I appreciate the help again. Hugs.

1 answer

0


The filter accepts a third parameter that basically forces the value to be exact:

...
<tr ng-repeat="post in posts | filter:{classification:classes}:true">
...

You can check the documentation of filter.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.