Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

p-inputNumber: Disabled is not working correcly when using ReactiveForms #15299

Closed
GabrielAPineiro opened this issue Apr 18, 2024 · 2 comments
Closed
Labels
Resolution: Invalid Issue or pull request is not valid in the latest version

Comments

@GabrielAPineiro
Copy link

Describe the bug

I have a wrapper component which is implementing ControlValueAcessor, and I'm using the setDisabledState from the primeng input. It's not working correctly when I start the form control as disabled. The input appears to be disabled, but once I click on it I'm able to edit the value, and then the field gets disabled for good.
inpuNumber-bug

Environment

I use a windows 11 laptop. Angular 17.3.5, PrimeNG 17.12.0 and node v20.10.0

Reproducer

https://stackblitz.com/edit/github-daas27-pb8btj?file=src%2Fapp%2Fapp.component.ts

Angular version

17.3.5

PrimeNG version

17.12.0

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

20.10.0

Browser(s)

No response

Steps to reproduce the behavior

  1. Load component with form initial state disabled
  2. See component looks disabled (inputDisabled is returning true, which shows the red border)
  3. Click inside the component, red border disappears and its possible to edit the value

Expected behavior

Component is disabled from the beginning and stays disabled until we enable it in the ReactiveForm

@GabrielAPineiro GabrielAPineiro added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Apr 18, 2024
@volvachev
Copy link
Contributor

Hi, in your example you can remove the [disabled]="disabled ?? false" and control disabled state via formControl. Everything will work as expected.

@cetincakiroglu cetincakiroglu added Resolution: Invalid Issue or pull request is not valid in the latest version and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Apr 19, 2024
@cetincakiroglu
Copy link
Contributor

Hi, in your example you can remove the [disabled]="disabled ?? false" and control disabled state via formControl. Everything will work as expected.

@GabrielAPineiro Please try this, closing the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Invalid Issue or pull request is not valid in the latest version
Projects
None yet
Development

No branches or pull requests

3 participants