Searching after filtering, AngularJS

Question

I'm using ui-select to create a multiple select that can be searched, but I think this problem can be replicated in any ng-repeat-like structure.

I have an array of languageIsoCodes, like this:

[es, en, it, ca, ar, af, al, fr]

I have a repeat looping this array with a filter to display the full-name of the language, for example: es -> Spanish

The problem is that I want that loop to be searchable, but when I'm typing, it only matches the isoCodes, and not the filtered words. Is there a way to search over the filtered loop?

<ui-select ng-model="vmDetails.stepDetails.sourceLanguageIsoCode" theme="selectize" title="Select a Language" required on-select="vmDetails.filterLanguages()">
  <ui-select-match placeholder="Select a Language">{{$select.selected|languages}} ({{$select.selected}})</ui-select-match>
  <ui-select-choices  repeat="sourceLanguageIsoCode as sourceLanguageIsoCode in vmDetails.selectedSource | filter: $select.search">
    <span>{{sourceLanguageIsoCode|languages}} ({{sourceLanguageIsoCode}})</span>
  </ui-select-choices>
</ui-select>

A visual example:


Show source
| html   | angularjs   | search   | loops   2017-11-29 18:11 0 Answers

Answers to Searching after filtering, AngularJS ( 0 )

Leave a reply to - Searching after filtering, AngularJS

◀ Go back