When using the p-dropdown component with a custom selectedItem template to customize the selected label display as per documentation, the template isn't rendered if the selected option equals to 0.
From a quick look at the code it seems that this is happening because of the condition selectedItemTemplate && selectedOption. In my case the selectedOption is 0 and is therefore considered falsy, but it should be a treated as a possible valid value.
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 https://github.com/primefaces/primeng/issues/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
.