2016-10-14 1 views
0

ich versuche Steuerung für E-Mail-Validator zu importieren und es zeigt meine Fehler in meinem Projekt ionischen 2 RC0, dies mein Codeionische 2: Import Control zeigt Fehler

/** 
* Created by adirz on 10/14/2016. 
*/ 

import { Control } from '@angular/common'; 
export class EmailValidator { 

    static isValid(control: Control) { 
    var re = /^(([^<>()\[\]\\.,;:\[email protected]"]+(\.[^<>()\[\]\\.,;:\[email protected]"]+)*)|(".+"))@((\[[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; 
    } 

    return {"invalidEmail": true}; 
    } 
} 

es Fehler zeigt, wenn i‘ m Import Control

Antwort

0

Versuchen FormControl statt Steuerung über wie this-

import { FormControl } from '@angular/forms' 

auch können Sie AbstractControl (Super-Klasse von Formcontrol) betrachten