1

I have a rather strange problem which I am unable to figure out. I am trying to append options to dynamically but somehow it doesn't seem to work or I am missing something. Thanks in advance.Plunker Here

2 Answers 2

4

This is not obvious. You have to have ng-model on your select for it to work.

http://plnkr.co/edit/tsm0FvzCpf1BuGDkBpEB

<select ng-model="selected" ng-options="c.name for c in list"></select>

I forget this often.

Sign up to request clarification or add additional context in comments.

2 Comments

thanks a lot man! Was breaking my head over this. Any idea why it requires a ng-model ? Just interested to know. Nevertheless thanks a lot!!!
I don't know why it is required, but I can say this has stung me many times.
0

You can do something like this:

http://plnkr.co/edit/pocWRU6oIfHSLJQgFtSp?p=preview

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.