I have searched Google and can\'t find anything on this.
I have this code.
Only one answer by Srivathsa Harish Venkataramana mentioned track by
which is indeed a solution for this!
Here is an example along with Plunker (link below) of how to use track by
in select ng-options
:
If selectedCity
is defined on angular scope, and it has id
property with the same value as any id
of any city
on the cities
list, it'll be auto selected on load.
Here is Plunker for this: http://plnkr.co/edit/1EVs7R20pCffewrG0EmI?p=preview
See source documentation for more details: https://code.angularjs.org/1.3.15/docs/api/ng/directive/select