Within my ng-controller, I am currently utilizing a small snippet of code that looks something like this:
<select ng-model="character" ng-options="ch.name for ch in characters"></select>
{{character}} <-- Works well, even {{character.attr}} functions correctly
{{attr}} <-- Unfortunately, does not update when the selection changes*
...function($scope){
$scope.character = characters[0]; <-- Successfully retrieves and sets object as expected
$scope.attr = $scope.character.name; <-- However, it only initializes a value*
which remains unchanged when the selection is altered
}
$scope.attr = character.name, $scope.attr = $scope.character['name']
, do not yield results. Consequently, functions such as these will never be successful:
$scope.attack_array = function(i){ <-- Unable to send a field or whole object **
let character = characters[i];
let array..
}
$scope.attack_array($scope.character.index) <-- How can I access individual values for each field?