Dropdown: when using selectedItem
template if the selected option is 0
then no template is rendered
#15366
Labels
LTS-16-PORTABLE
LTS-FIXED-16.9.11
Type: Bug
Issue contains a bug related to a specific component. Something about the component is not working
Milestone
Describe the bug
When using the
p-dropdown
component with a customselectedItem
template to customize the selected label display as per documentation, the template isn't rendered if the selected option equals to0
.From a quick look at the code it seems that this is happening because of the condition
selectedItemTemplate && selectedOption
. In my case theselectedOption
is0
and is therefore considered falsy, but it should be a treated as a possible valid value.In a way it seems to be related to issue #14954
Environment
MacOS 14.2.1
Reproducer
https://stackblitz.com/edit/github-41pgth?file=src%2Fapp%2Fapp.component.html
Angular version
17.3.5
PrimeNG version
17.14.1
Build / Runtime
Angular CLI App
Language
TypeScript
Node version (for AoT issues node --version)
LTS
Browser(s)
No response
Steps to reproduce the behavior
p-dropdown
component0
selectedItem
template0
Expected behavior
The custom template should be rendered even if the selected option is
0
.The text was updated successfully, but these errors were encountered: