I have 2 inputs.
<input type="number" ng-model="samount" ng-change="getSR(samount)">
<input type="number" ng-model="ramount" ng-change="getRS(ramount)">
in controller
$scope.getSR = function(amount) {
$scope.ramount = parseFloat((amount*5.25).toFixed(3));
};
$scope.getRS = function(amount) {
$scope.samount = parseFloat((amount/5.25).toFixed(3));
};
I enter some data in input 1 and do some calculations and update value of input 2 with function in controller. This works, but when I enter data in input 2 reverse calculate and update input 1. For some reason, input 1 value is not updating. I used $scope.$watch to see if input 1 is updated and it is updating in $watch, but not in view. If I reload and start with input 2 it works, input 1 updates, but typing input 1 doesn't update again. they are in same scope but ng-change is different functions.
$scope.$apply() in each function gives error apply already in progress.
Is there way to fix this issue?
EDIT: added example code