format results as #,###.00
This commit is contained in:
parent
074ca9c791
commit
7db87cd0a9
2 changed files with 12 additions and 11 deletions
|
|
@ -420,11 +420,11 @@
|
|||
<span translate>Amount</span><span ng-show="showAlternative"> [{{home.alternativeIsoCode}}]</span>
|
||||
</label>
|
||||
<div class="input">
|
||||
<div ng-if="!index.isCordova">
|
||||
<div ng-if="index.isCordova">
|
||||
<input type="amount" readonly="true" ng-show="!showAlternative" id="amount" ng-disabled="home.lockAmount" name="amount" ng-attr-placeholder="{{'Amount in'|translate}} {{home.unitName}}" ng-model="_amount" valid-amount required autocomplete="off" ng-focus="openInputAmountModal()" ignore-mouse-wheel>
|
||||
<input type="amount" readonly="true" ng-show="showAlternative" id="alternative" ng-disabled="!home.isRateAvailable || home.lockAmount" name="alternative" ng-attr-placeholder="{{'Amount in'|translate}} {{ home.alternativeName }}" ng-model="_alternative" required autocomplete="off" ng-focus="openInputAmountModal()" ignore-mouse-wheel>
|
||||
</div>
|
||||
<div ng-if="index.isCordova">
|
||||
<div ng-if="!index.isCordova">
|
||||
<input type="number" ng-show="!showAlternative" id="amount" ng-disabled="home.lockAmount" name="amount" ng-attr-placeholder="{{'Amount in'|translate}} {{home.unitName}}" ng-model="_amount" valid-amount required autocomplete="off" ignore-mouse-wheel>
|
||||
<input type="number" ng-show="showAlternative" id="alternative" ng-disabled="!home.isRateAvailable || home.lockAmount" name="alternative" ng-attr-placeholder="{{'Amount in'|translate}} {{ home.alternativeName }}" ng-model="_alternative" required autocomplete="off" ignore-mouse-wheel>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('inputAmountController', function($rootScope, $scope, platformInfo, lodash, configService, go, rateService) {
|
||||
angular.module('copayApp.controllers').controller('inputAmountController', function($rootScope, $scope, $filter, platformInfo, lodash, configService, go, rateService) {
|
||||
var unitToSatoshi;
|
||||
var satToUnit;
|
||||
var unitDecimals;
|
||||
|
|
@ -26,8 +26,11 @@ 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);
|
||||
|
||||
if (isExpression($scope.amount)) {
|
||||
var decimals = $scope.showAlternativeAmount ? 2 : unitDecimals;
|
||||
$scope.globalResult = '= ' + evaluate(format($scope.amount)).toFixed(decimals);
|
||||
}
|
||||
};
|
||||
|
||||
function checkFontSize() {
|
||||
|
|
@ -97,13 +100,11 @@ angular.module('copayApp.controllers').controller('inputAmountController', funct
|
|||
var result = evaluate(formatedValue);
|
||||
|
||||
if (lodash.isNumber(result)) {
|
||||
if ($scope.showAlternativeAmount)
|
||||
$scope.globalResult = isExpression(val) ? '= ' + result.toFixed(2) : '';
|
||||
else
|
||||
$scope.globalResult = isExpression(val) ? '= ' + result.toFixed(unitDecimals) : '';
|
||||
var decimals = $scope.showAlternativeAmount ? 2 : unitDecimals;
|
||||
|
||||
$scope.amountResult = toFiat(result).toFixed(2);
|
||||
$scope.alternativeResult = fromFiat(result).toFixed(unitDecimals);
|
||||
$scope.globalResult = isExpression(val) ? '= ' + result.toFixed(decimals) : '';
|
||||
$scope.amountResult = $filter('formatFiatAmount')(toFiat(result));
|
||||
$scope.alternativeResult = $filter('formatFiatAmount')(fromFiat(result));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue