I have an autocomplete search box.
<div ng-repeat="item in items| filter:search">
I would like to make it slightly better by sorting the results based on the the name of the items.
item1 {name:'applePy'}
item2 {name:'pineApple'}
item3 {name:'application'}
item4 {name:'anApple'}
item5 {name:'apple'}
With the current implementation when I write appl in the search box the result will be shown as follow:
anApple
apple
applePy
application
pineApple
But I would like the result to be ordered according to the inserted appl like:
apple
applePy
application
anApple
pineApple
The difference between the two ordering is that in this example the result is ordered according to the search string appl and the the rest of the result alphabetically.
How can I do this?