I am struggling trying to set the default value of a select box from a value in the controller.
my controller has
controller.item = {name: "bar1", value:1}
controller.items = [{name: "bar0", value:0},{name: "bar1", value:1}]
my html is
<p>{{controller.item}}</p>
<select ng-model="controller.item" ng-options="item.name for item in controller.items" >
</select>
when i run the code, the correct value of controller.item is shown in the form
{"name": "bar1", "value": 1}
but the select box has the first entry showing (bar0)
what am I missing here ? I've looked on the web, but all the examples I've seen say that you must do
controller.item = controller.items[0]
however, that's not right for the scenario where the value is already set
thanks