send working with uris

This commit is contained in:
Matias Alejo Garcia 2014-12-08 23:45:34 -03:00
commit 97c93e7909
3 changed files with 202 additions and 216 deletions

View file

@ -32,12 +32,6 @@ angular.module('copayApp.directives')
link: function(scope, elem, attrs, ctrl) {
var validator = function(value) {
// If we're setting the domain, ignore the change.
if ($rootScope.merchant && $rootScope.merchant.domain && value === $rootScope.merchant.domain) {
ctrl.$setValidity('validAddress', true);
return value;
}
// Regular url
if (/^https?:\/\//.test(value)) {
ctrl.$setValidity('validAddress', true);
@ -53,6 +47,11 @@ angular.module('copayApp.directives')
return value;
}
if (typeof value == 'undefined') {
ctrl.$pristine = true;
return;
}
// Regular Address
var a = new Address(value);
ctrl.$setValidity('validAddress', a.isValid() && a.network().name === $rootScope.wallet.getNetworkName());
@ -111,14 +110,11 @@ angular.module('copayApp.directives')
var str_value = ('' + value).substring(sep_index + 1);
if (sep_index > 0 && str_value.length > decimals) {
ctrl.$setValidity('validAmount', false);
scope.notValidAmount = true;
} else {
ctrl.$setValidity('validAmount', true);
scope.notValidAmount = null;
}
} else {
ctrl.$setValidity('validAmount', false);
scope.notValidAmount = null;
}
return value;
}