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
Change event listener for SlideToggle
#562
Comments
Hey @dumtux I'd recommend checking the source code to see how we forward events for this component. Most events are attached to the hidden checkbox input within the component template: This is also included in the component documentation: So an <SlideToggle bind:checked={is_monitoring} on:change={onChange}</SlideToggle> Then your console.log in the function should return the expected value. If for some reason you wish to obtain the state directly from the event, you would modify your function onChange(event: any) {
console.log(event.target.checked);
}
Let me know if this works for you! |
Note, small issue above that I've corrected. It should be |
Yes, this worked perfectly. |
@dumtux No worries, glad it worked. Note we're still in the process of adding and refining events in the docs, so some components may lack desired events. We have a ticket to address this in the near future though: |
Describe what feature you'd like. Pseudo-code, mockups, or screenshots of similar solutions are encouraged!
Is it possible to have event listener of SlideToggle like this?
How can I get on-change event instead of polling
is_checked
status manually?What type of pull request would this be?
No response
Any links to similar examples or other references we should review?
No response
The text was updated successfully, but these errors were encountered: