primefaces / primeng

The Most Complete Angular UI Component Library
https://primeng.org
Other
9.85k stars 4.51k forks source link

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

Open bvx5009 opened 2 weeks ago

bvx5009 commented 2 weeks ago

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

dl3g0 commented 2 weeks ago

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)]

bvx5009 commented 2 weeks ago

@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