The client side form validation is offered the AngularJS. The state of the form and input fields are monitored by AngularJS which helps us to notify the user about the current state along with, it also keeps the information if they have been changed/ modified, or not. So, in this tutorial, we will learn form validation using Angular Validator in Ionic framework.
Angular validator class contains some built-in method for validation.
Validator.required:The required validator ensure that value is entered the input field.
Validator.minLength(number):The minLength(num) validator controlar require that value is greater than a number.
Validator.maxLength(number): The maxLength(num) validator controlar require that value is less than a number.
Validator.email:The email Validator that performs email validation.
Validator.pattern(‘RegExp’):The pattern(‘RegExp’) validator controller match the regular expression to its value.
To use the angular validator build-in method for validation, we required two more controllers to implement form validation and those are FormControl and FormGroup but however, this is not sufficient to validate all input field that can be needed to implement our own custom validators.
A formControl is tied to the particular input field with the value is entered by the user. You can define the multiple validators for single formControl.
Tied the input value in the Template using the MyControl directive home.html file.