Autocomplete doesn't work as expected when working with Objects if the Object contains key named value
#17469
Labels
Status: Needs Triage
Issue will be reviewed by Core Team and a relevant label will be added as soon as possible
Describe the bug
Autocomplete doesn't behave as expected when working with objects and object has a key called
value
. When selecting an item from Autocomplete suggestion, expected selected item is supposed to be an object containing all the keys in the object. But selected item contains onlyvalue
key.However, if I simply rename
value
key to something else, saycode
, then behavior is as expected. Selected item in this contains all keys from the object.Based on the example for Autocomplete when working with objects - https://primeng.org/autocomplete#objects, I have forked the StackBlitz example to showcase the issue at: https://stackblitz.com/edit/7pl9oavs-6kg2ha5d
Pull Request Link
No response
Reason for not contributing a PR
Other Reason
No response
Reproducer
https://stackblitz.com/edit/7pl9oavs-6kg2ha5d
Environment
Windows 11
Angular version
19.0.1
PrimeNG version
v19
Node version
No response
Browser(s)
No response
Steps to reproduce the behavior
value
key. e.g if you selectUnited States
, the selected item is shown asUS
instead of expected{name: 'United States', value: 'US'}
countryservice.ts
and rename keyvalue
to something else likecode
. Save and run.Expected behavior
Selected item should contain all object keys
The text was updated successfully, but these errors were encountered: