-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
Dropdown: "0" Value in optionValue, causes Label to be replaced by Placeholder #14715
Comments
Hi, Not sure if this is by design or if more options should be available other than '0' such as true, false or empty string. If empty/null comparison is enough, the linked PR should be okay |
Hi rosenthalj, I'll be investigating your suggestion, I did not encountered any incorrect behaviour while testing the change but i'll retry :) |
Cr3aHal0, When testing I would recommend that you try the following "filtering" cases:
|
Fixed in #14719 |
Thank you for being fast with the issue. Thats great |
Describe the bug
When the value of the dropdown is 0, the placeholder value is still shown in the input.
This is the line causing the issue
return this.modelValue() ? this.getOptionLabel(this.selectedOption) : this.placeholder || 'p-emptylabel';
this Line in component.ts causes '0' to be accepted as False. You should check for null or undefined.
Thanks
Environment
Win10/chrome
Reproducer
No response
Angular version
17.1.2
PrimeNG version
17.5.0
Build / Runtime
Angular CLI App
Language
TypeScript
Node version (for AoT issues node --version)
18.19.0
Browser(s)
Chrome 121
Steps to reproduce the behavior
Expected behavior
The optionLabel should show the Label of the optionValue with Value 0
The text was updated successfully, but these errors were encountered: