0

I have a dropdown select with some options to filter the displayed list according to the selected option.

<form class="list">
  <label class="item item-select">
    <span class="input-label">Select career</span>
    <select ng-model="searchFromSelect">
        <option></option>
        <option>Admin</option>
        <option>IT</option>
        <option>Transport</option>
    </select>
  </label>

  <ion-item ng-repeat="career in careers | filter:searchFromSelect" class="item-icon-right balanced" ng-click="openCareer(career)">{{ career.AREA }}
    <i class="icon ion-ios-arrow-right"></i>
  </ion-item>

</form>

controller

$scope.vagas = response.data;

console.log : {"data":[{"ID":"1","AREA":"Admin","Benefits":"Transport"},{"ID":"2","AREA":"IT","Benefits":"Transport"}]}  

How can I make it more accurate to show me the list items according only to "AREA"?

Note that if I choose Transport, it displays both "Admin" and "IT" because "Transport" is a benefit from them.

I was trying to use "strict" like here but it did not work.

1 Answer 1

1

According to the filter filter documentation, you can specify your filter expression as an object. To filter only on AREA properties, use :

ng-repeat="career in `careers| filter:{AREA: searchFromSelect}"
Sign up to request clarification or add additional context in comments.

Comments

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.