Skip to content
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: "[object Object]" displayed when optionLabel input is used and the computed label value is null or undefined #16040

Open
fredpeaks opened this issue Jul 17, 2024 · 2 comments · May be fixed by #16231
Labels
Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible

Comments

@fredpeaks
Copy link

Describe the bug

The problem is at this line of code : https://github.com/primefaces/primeng/blob/e142de683b9cbcf2342774e9390ee09b0934580f/src/app/components/autocomplete/autocomplete.ts#L787C17-L787C59

It should not return the full object when the computed label is null or undefined.

Environment

not relevant

Reproducer

No response

Angular version

18

PrimeNG version

17.18.4

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

latest

Browser(s)

No response

Steps to reproduce the behavior

No response

Expected behavior

No response

@fredpeaks fredpeaks added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Jul 17, 2024
@maruthumj
Copy link
Contributor

@fredpeaks can you please create a reproducer in stackblitz?

@MW8086
Copy link

MW8086 commented Jul 29, 2024

Hello,
I have a similar problem.
To reproduce, replace
this.formGroup = new FormGroup({ selectedCountry: new FormControl<object | null>(null) });

with

this.formGroup = new FormGroup({ selectedCountry: new FormControl<object | null>({ "name": null, "code": null }) });

in the src\app\showcase\doc\autocomplete\reactiveformsdoc.ts file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants