Being able to prevent ion-toggle from toggling
See original GitHub issueHi,
I know there is the “disabled” property to completely prevent any click on the ion-toggle element but in some cases I would like to let the user clicks on the toggle, then it does an async process, and switch only if the process has succeeded.
For example, the user wants to turn ON an option that requires additional information (little form through a modal), if the user leaves the process, I would like to let the toggle on OFF (without seeing a quick transition OFF/ON/OFF).
I tried to catch the click
event to stopPropagation… but it doesn’t work, the toggle continues to move.
Maybe the easiest solution would be to make us able to trigger stopPropagation from the $event passed inside ionChange
.
What do you think 😃 ?
Thanks,
Issue Analytics
- State:
- Created 5 years ago
- Reactions:7
- Comments:8 (1 by maintainers)
Top Results From Across the Web
Being able to prevent ion-toggle from toggling #17748 - GitHub
Hi,. I know there is the "disabled" property to completely prevent any click on the ion-toggle element but in some cases I would...
Read more >ionic framework - unable to prevent ion-toggle from toggling
Another solution would be to bind the toggle with [(ngModel)] and set it back to false when the validation runs and the toggle...
Read more >Using event.preventDefault to prevent ion-toggle to toggle
I am using ion-toggle in my app . when user clicks(checks) on the ion-toggle , i have written ionChange hook on the ion-toogle...
Read more >ion-toggle for State change problem : r/ionic - Reddit
I am trying to use ion-toggle. I am initializing his state based on an isStatusInProgress variable. Until here, everything is fine. When I...
Read more >Not change Ionic toggle value in workflow - Bubble Forum
Use the conditional Workflows on your main workflow. The ionic toggle has this feature built in btw. Just use autobind.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
had the same usecase, listening to click event instead of ionChange and using
did the trick however this only works if the user clicks on the toggle, if he swipes it the same issue exists and even worse it will not be caught by the click handler
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. 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.