My webserver (node.js) serves a JSON file with a list of languages in the format:
{ "en" : "English", "fr" : "French" }
and a separate JSON settings dictionary like this: { "currentLanguage" : "en" }
. The select statement is as follows:
<select ng-options="for (code, name) in languages track by code" ng-model="config.currentLanguage"></select>
Unfortunately, this results in a blank option being added and selected because it compares values by reference rather than value. Is there a way to have it compare values instead? It seems like a common issue to separate current selection data from the options generation data. Is there a different approach I should take to work around this?