Skip to content

Instantly share code, notes, and snippets.

@Piterden
Forked from ganqqwerty/app.component.ts
Created June 19, 2019 21:02
Show Gist options
  • Select an option

  • Save Piterden/175a8f9b1e55e3e8a4800f06a7f5dc25 to your computer and use it in GitHub Desktop.

Select an option

Save Piterden/175a8f9b1e55e3e8a4800f06a7f5dc25 to your computer and use it in GitHub Desktop.

Revisions

  1. @ganqqwerty ganqqwerty revised this gist Jun 18, 2019. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion app.component.ts
    Original file line number Diff line number Diff line change
    @@ -8,4 +8,6 @@ ngOnInit() {
    this.myForm = this.fb.group({
    myCheckbox: [''],
    myEmailField: ['', this.emailValidators]
    })
    })
    //...
    }
  2. @ganqqwerty ganqqwerty created this gist Jun 18, 2019.
    11 changes: 11 additions & 0 deletions app.component.ts
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    private emailValidators = [
    Validators.maxLength(250),
    Validators.minLength(5),
    Validators.pattern(/.+@.+\..+/)
    ];

    ngOnInit() {
    this.myForm = this.fb.group({
    myCheckbox: [''],
    myEmailField: ['', this.emailValidators]
    })