feat(forms): update forms to latest version

This commit is contained in:
nixa 2016-07-08 13:10:36 +03:00
parent 4dfd7e8c28
commit 44924aefcc
7 changed files with 31 additions and 30 deletions

View file

@ -1,14 +1,14 @@
import {Control} from '@angular/common';
import {AbstractControl} from '@angular/forms';
export class EmailValidator {
public static validate(c: Control) {
public static validate(c:AbstractControl) {
let EMAIL_REGEXP = /^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i;
return EMAIL_REGEXP.test(c.value) ? null : {
validateEmail: {
valid: false
}
};
}
}
}

View file

@ -1,11 +1,11 @@
import {Control, ControlGroup} from '@angular/common';
import {FormGroup} from '@angular/forms';
export class EqualPasswordsValidator {
public static validate(firstField, secondField) {
return (c: ControlGroup) => {
return (c:FormGroup) => {
return (c.controls && c.controls[firstField].value == c.controls[secondField].value) ? null : {
passwordsEqual: {
valid: false
@ -13,4 +13,4 @@ export class EqualPasswordsValidator {
};
}
}
}
}