-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Autocomplete: ng-invalid and ng-dirty immediatly on startup #14149
Comments
Maybe I'm wrong, but I think is not a problem of PrimeNG. The default behavior you're observing is actually an aspect of Angular. When a required field is initially empty, Angular marks it as https://stackoverflow.com/questions/70857966/angular-reactive-form-is-invalid-on-page-load |
Hi @jakobschadeUCS, could you try the same with PrimeNg version 16.6.x? I’ve been facing a lot of issues with forms since I updated to 1.7.x |
Hi, We're aware of the issues with the form component in 16.7.x, we'll address all of them within the 16.8.0 update. Could you please share a stackblitz reproducer so we can test if it happens in the fixed version of the autocomplete? |
Any ETA for that version @cetincakiroglu ? |
|
Here is a stackblitz example. |
@SoyDiego this did not happen in 16.6. there the p-autocomplete tag has the classes "ng-untouched ng-pristine ng-invalid" sadly it was not fixed in 16.8. there are still the classes "ng-untouched ng-invalid ng-dirty" on the p-autocomplete tag. @cetincakiroglu you can try it in my stackblitz example above. maybe it has something todo with the usage of angulars signals in the primeng code? |
Hi, 16.8 is now available could you please check it and give feedback if it happens in 16.8? |
no, sadly it is still not fixed in the new version. in 16.6 its pristine on startup in 16.8 it is dirty. |
@ProfEibe |
Thanks a lot, it's working! (ps i'm the same guy as the creator, but used the wrong profile, so thanks from him too 💯) |
Describe the bug
When I set the required attribute of the p-autocomplete component it is already on startup marked as dirty and invalid. So it has the red border without any user interaction.
Environment
Angular & PrimeNG 16
Reproducer
No response
Angular version
16.2.10
PrimeNG version
16.7.2
Build / Runtime
Angular CLI App
Language
TypeScript
Node version (for AoT issues node --version)
v18.18.0
Browser(s)
Chrome
Steps to reproduce the behavior
selectedAddress: Address | undefined = undefined;
Expected behavior
it should not have the invalid class on startup.
The text was updated successfully, but these errors were encountered: