How to use the ngx-validators.EmailValidators.normal 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 / email-validator / email-validator.component.ts View on Github external
import { EmailValidators } from 'ngx-validators';
import { FormGroup, FormControl, Validators, FormBuilder } from '@angular/forms';
import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'app-reactive-email-validator',
  templateUrl: './email-validator.component.html',
  styleUrls: ['./email-validator.component.css']
})
export class ReactiveFormEmailValidatorComponent implements OnInit {

  form: FormGroup;
  email = new FormControl('', Validators.compose([EmailValidators.normal]));
  constructor(protected _fb: FormBuilder) { }

  ngOnInit() {
    this.form = this._fb.group({
      'email': this.email,
    });
  }

}
github Nightapes / ngx-validators / examples / src / app / email-validator / reactive-form / email / reactive-form-email.component.ts View on Github external
import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
import { EmailValidators } from 'ngx-validators';
import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'app-reactive-email',
  templateUrl: './reactive-form-email.component.html'
})
export class ReactiveFormEmailComponent implements OnInit {

  form: FormGroup;
  email = new FormControl('', Validators.compose([EmailValidators.normal]));
  constructor(protected _fb: FormBuilder) { }

  ngOnInit() {
    this.form = this._fb.group({
      'email': this.email,
    });
  }

  addToForm(email) {
    this.form.get('email').setValue(email);
  }
}