-
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: Broken since PrimeNG 17.15.0 due to the new optionValue
support
#15393
Comments
You can add |
I know, but in my case I need the whole It clearly worked before with PrimeNG |
Feels related to #15495 (context there is For those in search for a temporary potential workaround (as I agree on this being a bug), the same might work for this context (with Add:
to the p-autoComplete, with optionValueFn being initialised as:
More details can be found here: #15495 (comment). Curious whether this helps others in the meantime. |
@yorickp your workaround works. |
Maybe can Help, do not use a mix o optionValue and optionLabel when you use an object. This is something that wasn't clear to me when I read that the field was deprecated If you use an object like actor={key: 1, name: 'super mario'} in version 17.15 I used Field as suggested. Just an idea of example: console.log(form.get('actorControlName')?.value); Now field is deprecated and Primeng doc suggest to use optionLabel Just an idea of example: |
It's a breaking change introduced in a minor patch, needs a fix. |
@joinsaturn I didn't use This has to be fixed. |
I'm currently working on a fix for this and #15495 and will create a new PR. |
Describe the bug
Since PrimeNG 17.15.0 the AutoComplete display is broken due to the new
optionValue
support.In PrimeNG 17.14.0 wrapping an item in a
SelectItem
works and the selected item is displayed, but since PrimeNG 17.15.0 only[object Object]
is displayed when an item is selected.This bug was introduced with:
#14599
#15309
Environment
StackBlitz - PrimeNG AutocompleteReactiveFormsDemo broken selected item display
Reproducer
https://stackblitz.com/edit/yzm5ng?file=src%2Fapp%2Fdemo%2Fautocomplete-reactive-forms-demo.ts,src%2Fapp%2Fdemo%2Fautocomplete-reactive-forms-demo.html,package.json%3AL13-L13
Angular version
17.3.6 and 17.3.1 (from StackBlitz)
PrimeNG version
17.15.0
Build / Runtime
Angular CLI App
Language
TypeScript
Node version (for AoT issues node --version)
v20.11.1
Browser(s)
Microsoft Edge 124.0.2478.67
Steps to reproduce the behavior
Wrap the suggestion items in a PrimeNG
SelectItem
as it was done inStackBlitz - PrimeNG AutocompleteReactiveFormsDemo broken selected item display
Expected behavior
It should work the same as it worked in PrimeNG 17.14.0:
See StackBlitz - PrimeNG AutocompleteReactiveFormsDemo working in PrimeNG 17.14.0
The text was updated successfully, but these errors were encountered: