Merge pull request #127 from Bitcoin-com/wallet/task/344

Fix - 344 - Add comma like first character
This commit is contained in:
Sam Cheng Hung 2018-05-21 11:45:52 +08:00 committed by GitHub
commit 1c2ced2366
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -307,12 +307,18 @@ angular.module('copayApp.controllers').controller('amountController', function($
}
if ($scope.amountModel.amount && $scope.amountModel.amount.length >= LENGTH_EXPRESSION_LIMIT) return;
if (($scope.amountModel.amount.indexOf('.') > -1 || $scope.amountModel.amount == '') && digit == '.') return;
if ($scope.amountModel.amount.indexOf('.') > -1 && digit == '.') return;
if ($scope.amountModel.amount == '0' && digit == '0') return;
if (availableUnits[unitIndex].isFiat && $scope.amountModel.amount.indexOf('.') > -1 && $scope.amountModel.amount[$scope.amountModel.amount.indexOf('.') + 2]) return;
if ($scope.amountModel.amount == '0' && digit != '.') { $scope.amountModel.amount = ''}
if ($scope.amountModel.amount == '0' && digit != '.') {
$scope.amountModel.amount = '';
}
if ($scope.amountModel.amount == '' && digit == '.') {
$scope.amountModel.amount = '0';
}
$scope.amountModel.amount = ($scope.amountModel.amount + digit).replace('..', '.');
checkFontSize();
$scope.processAmount();