Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I'm attempting to use a simple key: value mapping to define the elements of a select field but I can't seem to figure out the correct syntax for ng-options. What I have, currently looks like this:

this.selectOptions = {
    "Label One": "Value One",
    "Label Two": "Value Two"
};

<select
  ng-model="selectOption"
  ng-options="key for (key, value) selectOptions">
</select>
share|improve this question

1 Answer 1

I figured it out, forgot "in" in my selector. Should have been:

<select
  ng-model="selectOption"
  ng-options="key for (key, value) in selectOptions">
</select>
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.