I have the following object that I wish to use to populate a select box.
This is enable the selection of icon marker on a map.
$scope.map_icons = {
bar: {
type: "bar",
iconUrl: "dir/bar.png",
shadowUrl: null,
shadowRetinaUrl: null,
iconSize: [32, 37],
iconAnchor: [16, 37],
popupAnchor: [0,-32]
},
restaurant: {
type: "restaurant",
iconUrl: "dir/restaurant.png",
shadowUrl: null,
shadowRetinaUrl: null,
iconSize: [32, 37],
iconAnchor: [16, 37]
},
deli: {
type: "deli",
iconUrl: "dir/fastfood.png",
shadowUrl: null,
shadowRetinaUrl: null,
iconSize: [32, 37],
iconAnchor: [16, 37]
},
sandwhichbar: {
type: "sandwhichbar",
iconUrl: "dir/sandwhich.png",
shadowUrl: null,
shadowRetinaUrl: null,
iconSize: [32, 37],
iconAnchor: [16, 37]
}
};
and in my template:
<select ng-model="newMarker.icon" ng-options="key for (key.iconUrl, key) in map_icons">
<option value="">-- choose icon --</option>
</select>
The desired output would be:
<select>
<option value="">-- choose icon --</option>
<option value="dir/bar.png">bar</option>
<option value="dir/restaurant.png">restaurant</option>
<option value="dir/fastfood.png">deli/option>
<option value="dir/sandwhich.png">sandwhichbar</option>
</select>