-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Component: Checkbox #15033
Comments
remove the value property binding of 1 and make sure your initial value throw the formControl it will take the job and make the binding |
We need to have the value property binding. In the my example only one checkbox is shown, but in the application we have a list of checkboxes binded to the same formControl. |
if so you need to bind all the checkboxes to the same form control but keep in mind this will reflect all the checkboxes value once any one triggered to true. also if you try to make a multiple choices using checkboxes then I suggest to use a form array. instead of form control |
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! |
Describe the bug
Update triggered twice
When having a p-checkbox with a formControl and the value attribute populated, then the control get updated twice
` <p-checkbox
[formControl]="fc2"
[value]="1"
inputId="binary"
[label]="'Label 2'"
this.fc2.valueChanges.subscribe(console.log);
Clicking the checkbox will result in two updates.
When you have the checkbox set to binary this does not happen.
Environment
The primeNG test environment
Reproducer
https://stackblitz.com/edit/d6vkvb?file=src%2Fapp%2Fdemo%2Fcheckbox-basic-demo.html
Angular version
17
PrimeNG version
17
Build / Runtime
Angular CLI App
Language
TypeScript
Node version (for AoT issues node --version)
18.8.0
Browser(s)
Chrome
Steps to reproduce the behavior
See the provided example repo
Expected behavior
To only receive one update
The text was updated successfully, but these errors were encountered: