code: function registerValidator(app, name, validator) {
    app.directive(name, function(bitcore) {
      return {
        require: 'ngModel',
        link: function(scope, elem, attr, ngModel) {
          function validate(value) {
            var valid = validator(bitcore, value, scope, attr);
            ngModel.$setValidity(null, valid);
            return value;
          }
          ngModel.$parsers.unshift(validate);
          ngModel.$formatters.unshift(validate);
        }
      };
    });
  }
docs: Filters