I see there are a lot of questions similar to this one, but I couldn't find any that requires exactly what I have:
- ngRepeat inside option-tag
- ngChange inside select-tag
I need to get the index of selected option. This is my code
<select data-placeholder="Choose" ng-model="pp.sif" name="myname" ng-change="onChangeSifra()">
<option ng-repeat="item in sif.what track by $index" value="{{item.SIF}}">
{{item.LABEL}}
</option>
</select>
ngClick inside option-tag doesn't work on Chrome and IE, so that is not an option. ngOption (in select-tag) instead of ngRepeat (in option-tag) is not an option because sif.what is an array of objects; also, that is why I can't use indexOf function (ngModel has only part of this object).
Any ideas?
EDIT: Since a lot of you are telling me to switch to ngOption, let me make it more clear why this isn't an option. I iterate trough something like this:
$scope.sif.what = [
{SIF: 1, LABEL: "label 1", SAVED: "save me 1"},
{SIF: 2, LABEL: "label 2", SAVED: "save me 2"},
{SIF: 3, LABEL: "label 3", SAVED: "save me 3"},
]
So in a combobox I have "label" as label, "sif" as value, ngModel is the value of "sif", but on ngChange I need the entire object, sif.what(index), or $index.
Thanks.