ng2-validators
Version:
An implementation of angular validators for Angular 2
164 lines • 6.57 kB
JavaScript
import { Directive, Input, forwardRef } from '@angular/core';
import { NG_VALIDATORS } from '@angular/forms';
import { UniversalValidators } from './universal-validators';
var WhiteSpaceValidatorDirective = (function () {
function WhiteSpaceValidatorDirective() {
}
WhiteSpaceValidatorDirective.prototype.ngOnInit = function () {
this.validator = UniversalValidators.noWhitespace;
};
WhiteSpaceValidatorDirective.prototype.validate = function (c) {
return this.validator(c);
};
return WhiteSpaceValidatorDirective;
}());
export { WhiteSpaceValidatorDirective };
WhiteSpaceValidatorDirective.decorators = [
{ type: Directive, args: [{
selector: '[noWhitespace][formControlName],[noWhitespace][formControl],[noWhitespace][ngModel]',
providers: [{
provide: NG_VALIDATORS,
// tslint:disable-next-line:no-forward-ref
useExisting: forwardRef(function () { return WhiteSpaceValidatorDirective; }),
multi: true
}]
},] },
];
/** @nocollapse */
WhiteSpaceValidatorDirective.ctorParameters = function () { return []; };
var EmptyStringValidatorDirective = (function () {
function EmptyStringValidatorDirective() {
}
EmptyStringValidatorDirective.prototype.ngOnInit = function () {
this.validator = UniversalValidators.noEmptyString;
};
EmptyStringValidatorDirective.prototype.validate = function (c) {
return this.validator(c);
};
return EmptyStringValidatorDirective;
}());
export { EmptyStringValidatorDirective };
EmptyStringValidatorDirective.decorators = [
{ type: Directive, args: [{
selector: '[noEmptyString][formControlName],[noEmptyString][formControl],[noEmptyString][ngModel]',
providers: [{
provide: NG_VALIDATORS,
// tslint:disable-next-line:no-forward-ref
useExisting: forwardRef(function () { return EmptyStringValidatorDirective; }),
multi: true
}]
},] },
];
/** @nocollapse */
EmptyStringValidatorDirective.ctorParameters = function () { return []; };
var IsNumberValidatorDirective = (function () {
function IsNumberValidatorDirective() {
}
IsNumberValidatorDirective.prototype.ngOnInit = function () {
this.validator = UniversalValidators.isNumber;
};
IsNumberValidatorDirective.prototype.validate = function (c) {
return this.validator(c);
};
return IsNumberValidatorDirective;
}());
export { IsNumberValidatorDirective };
IsNumberValidatorDirective.decorators = [
{ type: Directive, args: [{
selector: '[isNumber][formControlName],[isNumber][formControl],[isNumber][ngModel]',
providers: [{
provide: NG_VALIDATORS,
// tslint:disable-next-line:no-forward-ref
useExisting: forwardRef(function () { return IsNumberValidatorDirective; }),
multi: true
}]
},] },
];
/** @nocollapse */
IsNumberValidatorDirective.ctorParameters = function () { return []; };
var IsInRangeValidatorDirective = (function () {
function IsInRangeValidatorDirective() {
}
IsInRangeValidatorDirective.prototype.ngOnInit = function () {
this.validator = UniversalValidators.isInRange(this.minValue, this.maxValue);
};
IsInRangeValidatorDirective.prototype.validate = function (c) {
return this.validator(c);
};
return IsInRangeValidatorDirective;
}());
export { IsInRangeValidatorDirective };
IsInRangeValidatorDirective.decorators = [
{ type: Directive, args: [{
selector: '[isInRange][formControlName],[isInRange][formControl],[isInRange][ngModel]',
providers: [{
provide: NG_VALIDATORS,
// tslint:disable-next-line:no-forward-ref
useExisting: forwardRef(function () { return IsInRangeValidatorDirective; }),
multi: true
}]
},] },
];
/** @nocollapse */
IsInRangeValidatorDirective.ctorParameters = function () { return []; };
IsInRangeValidatorDirective.propDecorators = {
'minValue': [{ type: Input },],
'maxValue': [{ type: Input },],
};
var MaxValidatorDirective = (function () {
function MaxValidatorDirective() {
}
MaxValidatorDirective.prototype.ngOnInit = function () {
this.validator = UniversalValidators.max(this.max);
};
MaxValidatorDirective.prototype.validate = function (c) {
return this.validator(c);
};
return MaxValidatorDirective;
}());
export { MaxValidatorDirective };
MaxValidatorDirective.decorators = [
{ type: Directive, args: [{
selector: '[max][formControlName],[max][formControl],[max][ngModel]',
providers: [{
provide: NG_VALIDATORS,
// tslint:disable-next-line:no-forward-ref
useExisting: forwardRef(function () { return MaxValidatorDirective; }),
multi: true
}]
},] },
];
/** @nocollapse */
MaxValidatorDirective.ctorParameters = function () { return []; };
MaxValidatorDirective.propDecorators = {
'max': [{ type: Input },],
};
var MinValidatorDirective = (function () {
function MinValidatorDirective() {
}
MinValidatorDirective.prototype.ngOnInit = function () {
this.validator = UniversalValidators.min(this.min);
};
MinValidatorDirective.prototype.validate = function (c) {
return this.validator(c);
};
return MinValidatorDirective;
}());
export { MinValidatorDirective };
MinValidatorDirective.decorators = [
{ type: Directive, args: [{
selector: '[min][formControlName],[min][formControl],[min][ngModel]',
providers: [{
provide: NG_VALIDATORS,
// tslint:disable-next-line:no-forward-ref
useExisting: forwardRef(function () { return MinValidatorDirective; }),
multi: true
}]
},] },
];
/** @nocollapse */
MinValidatorDirective.ctorParameters = function () { return []; };
MinValidatorDirective.propDecorators = {
'min': [{ type: Input },],
};
//# sourceMappingURL=universal.directive.js.map