key-value pairs in ng-options
Solution 1:
use ng-option
:
<select ng-model="blah" ng-options="key as value for (key , value) in data"></select>
or use ng-repeat
:
<select>
<option ng-repeat="(key, value) in data" value="{{key}}">{{value}}</option>
</select>
data in controller:
$scope.data = {
"key1": "val1",
"key2": "val2",
"key3": "val3",
...
};
Solution 2:
The following article discusses the variety of ways that you can use ngOptions (by far the clearest, most thorough explanation I've ever seen): http://www.undefinednull.com/2014/08/11/a-brief-walk-through-of-the-ng-options-in-angularjs/