ng-jhipster
Version:
A Jhipster util library for Angular 2
30 lines (29 loc) • 1.14 kB
JavaScript
import { Directive, Input } from '@angular/core';
import { NG_VALIDATORS } from '@angular/forms';
import { forwardRef } from '@angular/core';
import { numberOfBytes } from './number-of-bytes';
export var MinbytesValidatorDirective = (function () {
function MinbytesValidatorDirective() {
}
MinbytesValidatorDirective.prototype.validate = function (c) {
return (c.value && numberOfBytes(c.value) >= this.jhiMinbytes) ? null : {
minbytes: {
valid: false
}
};
};
MinbytesValidatorDirective.decorators = [
{ type: Directive, args: [{
selector: '[jhiMinbytes][ngModel]',
providers: [
{ provide: NG_VALIDATORS, useExisting: forwardRef(function () { return MinbytesValidatorDirective; }), multi: true }
]
},] },
];
/** @nocollapse */
MinbytesValidatorDirective.ctorParameters = function () { return []; };
MinbytesValidatorDirective.propDecorators = {
'jhiMinbytes': [{ type: Input },],
};
return MinbytesValidatorDirective;
}());