Skip to content

Instantly share code, notes, and snippets.

View javebratt's full-sized avatar
🏠
Working from home

Jorge Vergara javebratt

🏠
Working from home
View GitHub Profile
@javebratt
javebratt / email-validator.ts
Last active September 1, 2017 11:24
Email Validator what works for NG2 and Ionic 2 apps.
import {FormControl} from '@angular/forms';
export class EmailValidator {
static isValid(control: FormControl){
var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(control.value);
if (re){
return null;