4

I didn't find anything that can help me on this trouble. I need to populate a select in an angular project. The problem is simple, all the other selects that I populated I had a json data like this

[{"id":1, "value":"A"},{"id":1, "value":"B"},{"id":1, "value":"B"}]

now instead my json data is a simple TreeMap structure like this

{1: "Jun 2011", 2: "Jul 2011", 3: "Aug 2011", 4: "Sep 2011"}

So, this isn't an array but an object and I wouldn't change the be service but I don't know if is possibile to populate a select with this type of object.

Can anyone help me?

Thanks!!

georgeawg
  • 48,608
  • 13
  • 72
  • 95
Fabrizio P
  • 241
  • 3
  • 13

1 Answers1

2
<select name="..." ng-model="data.selected" ng-options="key as value for (key, value) in options">
    <option value="">Select date</option>
</select>

See fiddle

Michel
  • 26,600
  • 6
  • 64
  • 69