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