Open slavafomin opened 5 months ago
There's some precedent for this with the clickAction
option in MatCheckbox
already so we should be able to something similar here.
there's disableToggleValue
in MatSlideToggleDefaultOptions which might help.
Feature Description
Hello! I'm using the
slide-toggle
component and I want to control when and how it's value changes. Just like controlled components in React. However, I can't find a way to do so.When I pass a signal (not a model) to the component via
[checked]="isChecked()"
the value of the component continues to change once a user clicks on it (totally ignoring the fact that the symbol is not changed). This looks like a bug to me, or at least something very counter-intuitive.Then I've tried to hook into the
(change)
event to manually call preventDefault() on it when the value changes, but the event object provided to the event handler doesn't have such method.Calling
preventDefault()
fromtoggle
/click
event handlers doesn't have any effect as well.What can I do to take the component under control?
Thanks.
Use Case
No response