I have a question regarding the angular ui button directive. I am working on creating a radio button and have provided a Plunker for reference: http://plnkr.co/edit/gUyGmb9wRqHYpLWUrBUs?p=preview
Whenever I change an input box, some logic is executed to update the values in the objects associated with my radio buttons.
The issue I am facing is that the "$scope.activeInput" variable does not get updated when I modify the data.
To provide more clarity, if you visit the Plunkr link and click on "specific energy", then type something in the input box, you will notice that nothing changes in the "my logic" section. However, if you switch to "total cost" and then back to "specific energy", the logic gets updated. I am looking to achieve real-time updating so that the connection between activeObject and the currently selected radio button is always up to date.
$scope.totalCost = {
title: 'Total cost',
unit: 'Mkr'
};
$scope.specificEnergy = {
title: 'Specific energy',
unit: 'kWh/m2,year'
};
$scope.absoluteEnergy = {
title: 'Absolute energy',
unit: 'Gwh/year'
};
//active input is not being properly updated
$scope.activeOutput = $scope.totalCost;
$scope.$watch('myValue', function(){
$scope.absoluteEnergy.value = $scope.myValue * 5;
$scope.specificEnergy.value = $scope.myValue * 15;
})