paypro: allow payment protocol addresses in address input.

This commit is contained in:
Christopher Jeffrey 2014-07-30 14:33:28 -07:00 committed by Manuel Araoz
parent 4d244a03f8
commit ad64ad1e0e
1 changed files with 5 additions and 0 deletions

View File

@ -12,6 +12,11 @@ angular.module('copayApp.directives')
require: 'ngModel',
link: function(scope, elem, attrs, ctrl) {
var validator = function(value) {
// Is payment protocol address?
if (value.indexOf('bitcoin:') === 0 && /r=/.test(value)) {
ctrl.$setValidity('validAddress', true);
return value;
}
var a = new Address(value);
ctrl.$setValidity('validAddress', a.isValid() && a.network().name === config.networkName);
return value;