primeng icon indicating copy to clipboard operation
primeng copied to clipboard

Dropdown: p-dropdown disabled property doesn't work with reactive forms only

Open bvx5009 opened this issue 2 years ago • 3 comments

Describe the bug

Adding a disabled property on the p-dropdown component does not disable it when using reactive forms but works with template forms.

reactive form: https://stackblitz.com/edit/zjnhge-6dbvzu

template form: https://stackblitz.com/edit/7ajim1-dw9brl

Environment

stackblitz

Reproducer

No response

Angular version

18.0.1

PrimeNG version

17.18.1

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

v18.20.3

Browser(s)

No response

Steps to reproduce the behavior

No response

Expected behavior

disabled property should disable the dropdown

bvx5009 avatar Jun 21 '24 13:06 bvx5009

hi @bvx5009 , To disable the input of a reactive form, you should do it this way image ,Then you need to remove [disabled]='true' from your HTML; this is only useful when using [(ngModel)]

dl3g0 avatar Jun 24 '24 17:06 dl3g0

@dl3g0 thanks for the reply!

yeah, that is what i ended up doing at the end. Seems like we should update the documentation or something. If i have a conditional variable to disable my form i have to do it in the ts rather than the property

bvx5009 avatar Jun 24 '24 17:06 bvx5009

Hi,

So sorry for the delayed response! Improvements have been made to many components recently, both in terms of performance and enhancement. Therefore, this improvement may have been developed in another issue ticket without realizing it. You can check this in the documentation. If there is no improvement on this, can you open a new issue so we can include it in our roadmap?

Thanks a lot for your understanding! Best Regards,

mertsincan avatar Dec 16 '24 11:12 mertsincan