fix(forms): properly validate empty strings with patterns (#11450)
This commit is contained in:

committed by
Chuck Jazdzewski

parent
43923ffcf5
commit
4a57dcfd8d
@ -96,7 +96,6 @@ export class Validators {
|
||||
*/
|
||||
static pattern(pattern: string): ValidatorFn {
|
||||
return (control: AbstractControl): {[key: string]: any} => {
|
||||
if (isPresent(Validators.required(control))) return null;
|
||||
let regex = new RegExp(`^${pattern}$`);
|
||||
let v: string = control.value;
|
||||
return regex.test(v) ? null :
|
||||
|
Reference in New Issue
Block a user