I'm having an issue getting just the value from a dropdown. I have the following structure:
$scope.categories = [
{id: 7, title: 'Peanut Butter'},
{id: 4, title: 'Mustard'},
{id: 3, title: 'Jelly'},
{id: 2, title: 'Jam'},
{id: 1, title: 'Mint Jelly'}
];
and I'm creating a dropdown as follows:
<select class="form-control" ng-model="testme.id" ng-options="c as c.title for c in categories track by c.id">
<option value="">------</option>
</select>
<input type="text" ng-model="testme.pos" />
The dropdown generates fine
For example, if I put in "3" into "testme.pos" and select "Jam", but the model "testme" comes with the following example result:
{id: {id: 2, title: 'Jam'}, pos: 3 },
What I would like to see:
{id: 2, pos: 3}
Any help would be great. I created a plnkr: Select Help