angular form with validation example
Example 1: validation minlength angular
Validators.minLength(9)
Example 2: formgroup check if valid
form: FormGroup;
onSubmit(){
//checks if form is valid
if( this.form.valid){
//more code here
}
}
Example 3: angular9+how+to+add+validators
this.form.controls["firstName"].setValidators([Validators.minLength(1), Validators.maxLength(30)]);