primeng icon indicating copy to clipboard operation
primeng copied to clipboard

Dropdown: Placeholder is not displayed when using a combination of reactive forms and selectedItem template

Open dorthrithil opened this issue 1 year ago • 2 comments

Describe the bug

Follow up on https://github.com/primefaces/primeng/issues/14695

When using a dropdown within a reactive form and while using the template for selectedItem, the placeholder is not shown.

Screenshot 2024-02-14 at 08 37 56

Environment

Chrome on Mac OS

Reproducer

https://stackblitz.com/edit/github-lobmlu-qzceky?file=src%2Fapp%2Fapp.component.html

Angular version

17.1.3

PrimeNG version

17.6.0

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

18.9.0

Browser(s)

No response

Steps to reproduce the behavior

Check the Stackblitz

Expected behavior

Placeholders always show when no option is selected.

dorthrithil avatar Feb 14 '24 07:02 dorthrithil

The follow change to line 29 of your reproducer fixes the issue:

Change: name: [''] To: name: [null]

Primefaces_-Primeng_Issue_Template__forked_-_StackBlitz

rosenthalj avatar Feb 14 '24 09:02 rosenthalj

Thanks @rosenthalj, this solves it for me. But I still think there is a little issue here as in the case "Reactive forms an no seletedItem template" the placeholder is shown, even though it uses the same control. I would expect the same placeholder behaviour for the case with template and without.

dorthrithil avatar Feb 14 '24 14:02 dorthrithil