Allow only dots to separate decimals
This commit is contained in:
parent
a0acf849ed
commit
cebd8fe06e
3 changed files with 10 additions and 44 deletions
|
|
@ -92,7 +92,6 @@ angular.module('copayApp.directives')
|
|||
require: 'ngModel',
|
||||
link: function(scope, element, attrs, ctrl) {
|
||||
var val = function(value) {
|
||||
if (value) value = Number(String(value).replace(/,/g, '.'));
|
||||
var settings = configService.getSync().wallet.settings;
|
||||
var vNum = Number((value * settings.unitToSatoshi).toFixed(0));
|
||||
|
||||
|
|
@ -120,33 +119,6 @@ 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