-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
setFormErrors for sub formGroup #1
Comments
@mandrilla34 const collaborador = this.fb.group<Colaborador>({
nombreCompleto: ["", [Validators.required]],
email: ["", [Validators.required]],
usuario: ["", [Validators.required]],
})
this.form = this.fb.group<ColaboradorCriar>({
idEmpresa: [],
colaborador: collaborador
});
collaborador.setFormErrors({
nombreCompleto: {
required: 'Esto es requerido..'
}
....
}) Now consider also that setFormErrors is rather a helper function created to assist in the rendering of errors via the directive in the package... so this is no vanilla angular per se. consider the following example note the use of the directive in the mat-error, the vision was to be a common companion with the above declaration in order to reduce boilerplate. Hope this helps |
This is an good option, it opens a range of solutions but the access to these errors seems far away, as it contains a lot of handling to validate because in addition I have to change the directive in the |
I'm having trouble setting the setFormErrors method in a sub group:
setFormErrors:
this.form.controls.colaborador.setFormErrors;
I've tried a few ways but I can't get the expected result.
The text was updated successfully, but these errors were encountered: