Skip to main content

Posts

Showing posts with the label FormControl

Angular Custom Form Validations –Email, Credit Card Number Validators

In this article, I am sharing about, how to create a custom validator for both model driven and template driven forms in Angular 5. Two Types of Validators – 1.       Built-in Validators 2.       Custom Model Form Validators a.       Email Validator b.       Password Validator c.        Secure Site Validator d.       Credit card validator Built-in Validators - 1.       Validators .required - Requires a form control to have a non-empty value 2.       Validators .minlength - Requires a form control to have a value of a min length 3.       Validators .maxlength - Requires a form control to have a value of a max length 4.       Validators .pattern - Requires a form control’s value to match a given regex. 5. ...