I have a simple dropdown filled with list of states:
<select name="state" ng-model="state_id" ng-options="s.name for s in states"></select>
How can I get only state id into my model instead of the whole object with both id and name?
"state_id": "MI" INSTEAD OF "state_id": {"id": "MI", "name": "Michigan" }
Got it, it's
ng-options="s.id as s.name for s in states"