angular-dynamic-forms
angular-dynamic-forms copied to clipboard
Display Errors on Submit
Hi @martinstefanovic wonderful code base for those who are working with Dynamic forms. But how to handle to display the errors on submit before entring any values, cuz the errors are triggered only when there is a change in the input, so basically the form loads and the users clicks on submit, how to handle it.
Thanks in advance.
onChange(event: Event) {
const formGroup = this.controlContainer.control as FormGroup;
this.errors = formGroup.controls[this.options.formControlName].errors;
if (this.errors) {
this.errors.errorMessage = this.options?.errorMessage;
}
}