Click here to Skip to main content
14,735,745 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hey,

I have a dozen examples of selects working in my app, but this is somehow not:

masterApp - JSFiddle[^]
Comments in fiddler explain the issue.

Basically, I have an array in the scope. I have a select ng-options based on that array. I populate the array. The options are empty >_<

What am I doing wrong this time?

Thanks
Andy
Posted
Comments
Richard Deeming 2-Feb-16 8:05am
   
Don't you need an ng-model on the <select> tag?
Andy Lanng 2-Feb-16 8:29am
   
not required (yet). That's only if you want to use the selected item. I can update it and try though
Andy Lanng 2-Feb-16 8:31am
   
godammit! your correct ^_^
Updated jsfiddle
Richard Deeming 2-Feb-16 8:56am
   
OK, I'll post that as an answer. :)

1 solution

The <select> tag needs an ng-model attribute before Angular will process it.
https://docs.angularjs.org/api/ng/directive/select[^]
   
Comments
Andy Lanng 2-Feb-16 8:59am
   
Face palming pretty hard right now. I knew it had to be something simple ^_^

Problem is my colleagues don't use angular

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900