I would like to have a dropdownlist that displays items of a string Array. I also would like to have as ng-model the index of the selected item in the dropdownlist.
I know I did not give the best description , so I write What I would be able to do.
HTML
<select ng-model="chosenPropertyIndex"
ng-options="arrayProperties.PropertyNames[idx] for idx in [0,1,2,3,4,5]"
></select>
Controller
$scope.chosenPropertyIndex = 0;
$scope.arrayProperties = [
"Property A",
"Property B",
"Property C",
"Property D",
"Property E",
"Property F"
];
Do you see a way to do something like that please?
Try this:
<select ng-model="chosenPropertyIndex" ng-options="arrayProperties.indexOf(prop) as prop for prop in arrayProperties"></select>