mirror of
https://github.com/akveo/ngx-admin.git
synced 2026-01-10 11:38:50 +01:00
feat(forms): update forms to latest version
This commit is contained in:
parent
4dfd7e8c28
commit
44924aefcc
7 changed files with 31 additions and 30 deletions
|
|
@ -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
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 {
|
|||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue