How to use the ngx-validators.UniversalValidators.minLength function in ngx-validators

To help you get started, we’ve selected a few ngx-validators examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Nightapes / ngx-validators / examples / src / app / reactive-forms / universal-validator / universal-validator.component.ts View on Github external
UniversalValidators.isNumber
  ]));

  isInRange: FormControl = new FormControl('', Validators.compose([
    Validators.required,
    UniversalValidators.isInRange(3, 6)
  ]));

  maxLength: FormControl = new FormControl('', Validators.compose([
    Validators.required,
    UniversalValidators.maxLength(5)
  ]));

  minLength: FormControl = new FormControl('', Validators.compose([
    Validators.required,
    UniversalValidators.minLength(3)
  ]));

  constructor(protected _fb: FormBuilder) { }

  ngOnInit() {
    this.form = this._fb.group({
      'noWhitespace': this.noWhitespace,
      'noEmptyString' : this.noEmptyString,
      'min': this.min,
      'max': this.max,
      'isNumber': this.isNumber,
      'isInRange': this.isInRange,
      'maxLength': this.maxLength,
      'minLength': this.minLength
    });
  }