Replaces comma by dot
This commit is contained in:
parent
93028b9be0
commit
ce05318d94
4 changed files with 43 additions and 12 deletions
|
|
@ -475,6 +475,8 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
$scope.customAlternative = newValue;
|
||||
if (typeof(newValue) === 'number' && $scope.isRateAvailable) {
|
||||
$scope.customAmount = parseFloat((rateService.fromFiat(newValue, $scope.alternativeIsoCode) * satToUnit).toFixed($scope.unitDecimals), 10);
|
||||
} else {
|
||||
$scope.customAmount = null;
|
||||
}
|
||||
},
|
||||
enumerable: true,
|
||||
|
|
@ -491,7 +493,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
if (typeof(newValue) === 'number' && $scope.isRateAvailable) {
|
||||
$scope.customAlternative = parseFloat((rateService.toFiat(newValue * $scope.unitToSatoshi, $scope.alternativeIsoCode)).toFixed(2), 10);
|
||||
} else {
|
||||
$scope.customAlternative = 0;
|
||||
$scope.customAlternative = null;
|
||||
}
|
||||
$scope.alternativeAmount = $scope.customAlternative;
|
||||
},
|
||||
|
|
@ -625,6 +627,8 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
$scope.__alternative = newValue;
|
||||
if (typeof(newValue) === 'number' && self.isRateAvailable) {
|
||||
$scope._amount = parseFloat((rateService.fromFiat(newValue, self.alternativeIsoCode) * satToUnit).toFixed(self.unitDecimals), 10);
|
||||
} else {
|
||||
$scope.__amount = null;
|
||||
}
|
||||
},
|
||||
enumerable: true,
|
||||
|
|
@ -640,7 +644,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
if (typeof(newValue) === 'number' && self.isRateAvailable) {
|
||||
$scope.__alternative = parseFloat((rateService.toFiat(newValue * self.unitToSatoshi, self.alternativeIsoCode)).toFixed(2), 10);
|
||||
} else {
|
||||
$scope.__alternative = 0;
|
||||
$scope.__alternative = null;
|
||||
}
|
||||
self.alternativeAmount = $scope.__alternative;
|
||||
self.resetError();
|
||||
|
|
|
|||
|
|
@ -85,14 +85,14 @@ angular.module('copayApp.directives')
|
|||
};
|
||||
}
|
||||
])
|
||||
.directive('validAmount', ['configService', '$locale',
|
||||
function(configService, locale) {
|
||||
.directive('validAmount', ['configService',
|
||||
function(configService) {
|
||||
|
||||
return {
|
||||
require: 'ngModel',
|
||||
link: function(scope, element, attrs, ctrl) {
|
||||
var val = function(value) {
|
||||
if (value) value = value.replace(/,/g, '.');
|
||||
if (value) value = Number(String(value).replace(/,/g, '.'));
|
||||
var settings = configService.getSync().wallet.settings;
|
||||
var vNum = Number((value * settings.unitToSatoshi).toFixed(0));
|
||||
|
||||
|
|
@ -120,6 +120,33 @@ angular.module('copayApp.directives')
|
|||
};
|
||||
}
|
||||
])
|
||||
.directive('validAlternative', [
|
||||
function() {
|
||||
|
||||
return {
|
||||
require: 'ngModel',
|
||||
link: function(scope, element, attrs, ctrl) {
|
||||
var val = function(value) {
|
||||
if (value) value = Number(String(value).replace(/,/g, '.'));
|
||||
var vNum = Number(value);
|
||||
|
||||
if (typeof value == 'undefined' || value == 0) {
|
||||
ctrl.$pristine = true;
|
||||
}
|
||||
|
||||
if (typeof vNum == "number" && vNum > 0) {
|
||||
ctrl.$setValidity('validAlternative', true);
|
||||
} else {
|
||||
ctrl.$setValidity('validAlternative', false);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
ctrl.$parsers.unshift(val);
|
||||
ctrl.$formatters.unshift(val);
|
||||
}
|
||||
};
|
||||
}
|
||||
])
|
||||
.directive('walletSecret', function(bitcore) {
|
||||
return {
|
||||
require: 'ngModel',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue