mirror of https://github.com/BTCPrivate/copay.git
fix decimal places when switch to alternative amount
This commit is contained in:
parent
d7b85e46e5
commit
074ca9c791
|
@ -26,6 +26,8 @@ angular.module('copayApp.controllers').controller('inputAmountController', funct
|
|||
|
||||
$scope.toggleAlternative = function() {
|
||||
$scope.showAlternativeAmount = !$scope.showAlternativeAmount;
|
||||
var decimals = $scope.showAlternativeAmount ? 2 : unitDecimals;
|
||||
$scope.globalResult = evaluate(format($scope.amount)).toFixed(decimals);
|
||||
};
|
||||
|
||||
function checkFontSize() {
|
||||
|
@ -95,9 +97,13 @@ angular.module('copayApp.controllers').controller('inputAmountController', funct
|
|||
var result = evaluate(formatedValue);
|
||||
|
||||
if (lodash.isNumber(result)) {
|
||||
$scope.globalResult = isExpression(val) ? '= ' + result.toFixed(2) : '';
|
||||
if ($scope.showAlternativeAmount)
|
||||
$scope.globalResult = isExpression(val) ? '= ' + result.toFixed(2) : '';
|
||||
else
|
||||
$scope.globalResult = isExpression(val) ? '= ' + result.toFixed(unitDecimals) : '';
|
||||
|
||||
$scope.amountResult = toFiat(result).toFixed(2);
|
||||
$scope.alternativeResult = fromFiat(result).toFixed(2);
|
||||
$scope.alternativeResult = fromFiat(result).toFixed(unitDecimals);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue