-
Notifications
You must be signed in to change notification settings - Fork 6
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
ValidationConfig issue #14
Comments
having the same issue and was about to post an issue as well. The problem is in line 175 of https://github.com/simplifiedcourses/ngx-vest-forms/blob/master/projects/ngx-vest-forms/src/lib/directives/form.directive.ts The stream is being created in the constructor but the control might not exist at this moment so it tries to subscribe on valueChanges and the end result is that an undefined value is being added to the streams and it tries to zip it. @GonzaloCorchon as a temporary workaround you can set the validationConfig from ngAfterViewInit in your component so it's filtered initially in the pipe and added at a moment when the control exists. @simplifiedcourses perhaps move the validationConfig code from the constructor to an ngAfterViewInit in the form.directive? |
After migrating to Angular 19, adding it to afterRender might be even better. Gonna try to provide a PR in the coming week(s) with Angular 19. But maybe a small bugfix until that time might be better. |
I'm seeing a similar error here, still on Angular 18.2.7. Just to confirm @GonzaloCorchon, the validationConfig also doesn't work in your case? |
Fixes ValidationConfig issue simplifiedcourses#14 See: simplifiedcourses#16
I've been banging my head against the wall for a couple of hours trying to make this library work in Angular 19.
From what I've been able to research, there is an issue with "validationConfig" and the ngForm in the FormDirective class.
When you create the streams based on the validationConfig property, the very first time the ngForm does not have the inner controls yet configured so you get a console error. If you apply a setTimeout trick to set the validationConfig after a second, then it works as expected.
I've prepared a really simple Stackblitz demo so you can see it live
https://stackblitz.com/edit/stackblitz-starters-susmgnkx?file=src%2Fmain.ts
The text was updated successfully, but these errors were encountered: