1

I have the following data.types:

types: Object
  4: "x"
  5: "c"
  9: "y"

And i'm trying this:

<select ng-options="key as value for (key, value) in data.types">

But can't get the select input populated. How to do this with ng-options instead of ng-repeat.

Christopher
  • 3,379
  • 7
  • 25
  • 36

2 Answers2

1
<select ng-model="yourModel" ng-options="key as value for (key, value) in data.types">

Should work

André Tiago
  • 131
  • 2
1

You missed ng-model in you select tag.

<select ng-model="yourNgModel" ng-options="key as value for (key, value) in data.types">
</select>

http://jsfiddle.net/414dow6m/

Darshan Patel
  • 2,839
  • 2
  • 25
  • 38