Skip to content Skip to sidebar Skip to footer

Validate Md-datepicker Using Formcontrol

I'm new to angular material 2, and trying to validate the Date of Birth(DOB) form field like following example in Official Angular Website So in input-errors-example.html I added f

Solution 1:

For your FormControl to work with your regex, you have to instantiate the FormControl with null instead of '' empty string:

dobFormControl = new FormControl(null, [
        Validators.required,
        Validators.pattern(DOB_REGEX)
    ]);

Your working now plunker here

Post a Comment for "Validate Md-datepicker Using Formcontrol"