You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat: ionCheck and ionUncheck for ion-checkbox #19096
Describe the Feature Request
I want to be able to trigger something when a checkbox is being checked/unchecked. ionChange does not work in some cases, see additional context below.
Describe Preferred Solution
Extend events on ion-checkbox to have ionCheck and ionUncheck, similar to ionSelect and ionDeselect on ion-radio.
Related Code
Working on a PR at the moment.
Additional Context
Let's say I have a list of items. Those items are custom components with a couple of checkboxes each. The data for this list comes from an observable I subscribed to. I use ionChange to detect if one of those checkboxes is being checked/unchecked and the previously mentioned observable is being triggered. This triggers ionChange again which then triggers the observable which then triggers ionChange... and now I am trapped in a pretty nasty endless loop.
I guess there could be more cases when you do not want do use ionChange to determine if a specific checkbox is being checked/unchecked.
With Vue, I made it work with the @click.native event. Basically, Checkboxes need a click event in ionic. <IonCheckboxVue v-model="user.check[index].val" @click.native="unCheckBoxes(index)"></IonCheckboxVue>
Hello, thanks for the issue. We have another issue here #20106 to track the bug with the infinite loop on ionChange. I know it's been a while, but if that one is resolved, would that take care of your use case? Or was there anything else preventing you from using ionChange and checking the checked property?
Thanks for the issue! This issue is being closed due to the lack of a reply. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.
Activity
Sacrekin commentedon Aug 15, 2019
With Vue, I made it work with the
@click.nativeevent. Basically, Checkboxes need a click event in ionic.<IonCheckboxVue v-model="user.check[index].val" @click.native="unCheckBoxes(index)"></IonCheckboxVue>mahnuh commentedon Aug 15, 2019
Yes, that is kind of what I did with my pull request.
averyrousseau commentedon Feb 2, 2022
Hello, thanks for the issue. We have another issue here #20106 to track the bug with the infinite loop on
ionChange. I know it's been a while, but if that one is resolved, would that take care of your use case? Or was there anything else preventing you from usingionChangeand checking thecheckedproperty?ionitron-bot commentedon Feb 16, 2022
Thanks for the issue! This issue is being closed due to the lack of a reply. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.
Thank you for using Ionic!