Angular7Javascript

Angular 7 Form Validation Methods for Different Input Fields

angular7
272Views

Hello to all, welcome to therichpost.com. In this post, I will tell you, Angular 7 Form Validation Methods for Different Input Fields.

If you are new in Angular 7, then please check old posts related to Angular 7.

In this post, I will give you tell some form input fields validations tricks In Angular 7.

ngOnInit() {
          this.formdata = new FormGroup({
                 //Number Validations and Min Max Validation
        	mobile_number : new FormControl("", [Validators.required, Validators.pattern("^[0-9]*$"), Validators.minLength(6), Validators.maxLength(10)]),

                 //Email Validation
        	email : new FormControl("", [Validators.required, Validators.email]),

                //Min lenght Validation
        	password : new FormControl("",  [Validators.required, Validators.minLength(5)]),

                //Empty Field Validation
        	package_type : new FormControl("", Validators.required),

       });

   
  }

 

For more information, please comment below or ask questions.

Harjas,

Thank you

Ajay Malhotra
the authorAjay Malhotra
Hello to all. Welcome to therichpost.com. Myself Ajay Malhotra and I am full stack developer. I love coding. I know Wordpress, Core php, Angularjs, Angular 2, Angular 6, Angular 7, laravel, Codeigniter, Shopify, Squarespace, Jquery, Google Map Api, Vuejs, Reactjs, Bigcommerce etc.

Leave a Reply

Positive SSL