Currently, I am facing an issue with loading a select box using the ng-options directive.
The problem is that I am unable to have the options display values ranging from 23-26, instead of 0-3. The values should match the "eigenschap_id" that I pass through.
I'm wondering where the mistake lies in my code. Below is the snippet I am working with:
Controller:
$scope.eigenschappen.game = categories.Game;
JSON string / object:
[{"cat_id":6,"cat_name":"Game","eigenschap_name":"RPG","eigenschap_id":23},{"cat_id":6,"cat_name":"Game","eigenschap_name":"Strategie","eigenschap_id":24},{"cat_id":6,"cat_name":"Game","eigenschap_name":"Avontuur","eigenschap_id":25},{"cat_id":6,"cat_name":"Game","eigenschap_name":"Simulatie","eigenschap_id":26}]
HTML View:
<select data-ng-options="i.eigenschap_id as i.eigenschap_name for i in eigenschappen.game" ng-model="chosen"></select>
Generated HTML:
<select ng-model="chosen" data-ng-options="i.eigenschap_id as i.eigenschap_name for i in eigenschappen.game" class="ng-pristine ng-valid">
<option value="?" selected="selected"></option>
<option value="0">RPG</option>
<option value="1">Strategie</option>
<option value="2">Avontuur</option>
<option value="3">Simulatie</option>
</select>