After testing out my code, I noticed that the following snippet in my view performs as expected. The player_id gets updated whenever a new selection is made:
<div class="form-group">
<select class="form-control" ng-model="player_id" ng-change="hithere();">
<option ng-repeat="player in players" value="{{ player.id }}">{{ player.name }}</option>
</select>
</div>
test works: {{ player_id }}
However, the code snippet below doesn't behave as anticipated. Despite my selections in the view, the log consistently displays the default value of 0:
$scope.player_id = 0;
...
$scope.hithere = function($event){
console.log('Test does not work, prints 0');
console.log($scope.player_id);
};
I'm puzzled by this discrepancy. Any insights on what could be wrong?