I have an array or 'players', and each player has a name, a score and other properties.
I have the following in my partial:
<select ng-model="personToAsk">
<option value=''>Select who you want to ask</option>
<option ng-repeat="p in players" value="{{$index}}">{{p.name}} ({{p.score}} points)</option>
</select>
<p>Selected player: {{selectedPerson.name}}
And in my controller:
$scope.selectedPerson = $scope.players[$scope.personToAsk];
But {{selectedPerson.name}} is not outputting anything.
If I hardcode the index in my players array ($scope.selectedPerson = $scope.players[0];), it does output the person, but how do I get to be dynamic, so when a player is selected in the dropdown, it shows the name only further down.
If I put {{personToAsk}} in my template, it does output a number.