Have this HTML:
<select ng-model="group" ng-options="g.key for g in groups"></select>
Although $scope.groups
is map {'a':'', 'b':'', 'c':''}
I'd like select to display map keys: a,b,c
Currently it selects nothing.
How to change ng-options
?\
UPDATE 1
g for g in Object.keys(groups)
does not work either.
You can use this syntax:
<select ng-model="group" ng-options="key for (key, g) in groups"></select>
You can check out the full documentation for the select
directive, especially the ngOptions details: http://docs.angularjs.org/api/ng.directive:select
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With