Allow only dots to separate decimals

This commit is contained in:
Gustavo Maximiliano Cortez 2015-08-13 12:59:19 -03:00
commit cebd8fe06e
No known key found for this signature in database
GPG key ID: 15EDAD8D9F2EB1AF
3 changed files with 10 additions and 44 deletions

View file

@ -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',