add validation to wallet secret

This commit is contained in:
Yemel Jardi 2014-05-14 14:24:24 -07:00
commit 9d5f2ddf16
4 changed files with 29 additions and 7 deletions

View file

@ -64,6 +64,21 @@ angular.module('copay.directives')
};
}
])
.directive('walletSecret', ['walletFactory',
function(walletFactory) {
return {
require: 'ngModel',
link: function(scope, elem, attrs, ctrl) {
var validator = function(value) {
ctrl.$setValidity('walletSecret', Boolean(walletFactory.decodeSecret(value)));
return value;
};
ctrl.$parsers.unshift(validator);
}
};
}
])
.directive('loading', function() {
return {
restrict: 'A',