C
C
Carry2014-07-09 17:59:19
Angular
Carry, 2014-07-09 17:59:19

How to sort in autocomplete?

Here is an example:
Example
As far as I understand, when the page is loaded, all the data in customTemplate.html is given at once, so sorting in the database does not work.
Sorting should be here:

typeahead="c as c.country for c in countries | filter:$viewValue | orderBy:????? |limitTo:10"

what should be added?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey, 2014-07-09
Protko @Fesor

I strongly advise against using filters for collections - they will work for every sneeze (every $digest of this scope). It is better to do it all the same where you transfer a new collection to the scope.

C
Carry, 2014-07-09
@carryx

I agree, I tried to insert values ​​into orderBy (although sorting did not work for me), brakes are noticeable
while I understand the code, can you tell me where and what needs to be added,
I will be grateful

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question