Search code examples
angularjsangularjs-ng-repeatng-options

AngularJS - ng-options isn't working


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.


Solution

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

    Should work