Sunday, July 12, 2020
therichposts@gmail.com
Angular7Javascript

Angular 7 Form Validation Methods for Different Input Fields

Views

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 freelance full stack developer. I love coding. I know Wordpress, Core php, Angularjs, Angular 2, Angular 6, Angular 7, Angular 8, Angular 9, Angular 10 Nodejs, laravel, Codeigniter, Shopify, Squarespace, Jquery, Google Map Api, Vuejs, Reactjs, Bigcommerce etc.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.