-
-
Notifications
You must be signed in to change notification settings - Fork 386
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
Add public change handler to checkbox #576
Conversation
Added OnValueChanged handler, to handle onchange action. Currently overloading of onchange attribute of MatCheckbox has no results.
…ndler-to-checkbox Add public change handler to checkbox
I'm not sure if this is actually needed, also don't think using Could you please explain why you need / want this? Maybe it's to do something that you can already do, but don't know how yet. |
Hi @EduVencovsky , I need to override onchange attribute of MatCheckbox to do additional action when value changed. I tried override onchange, but it didn't call my method. Currently I override onclick attribute as workaround, but my checkbox inside of MatListItem, so, I have double call of method.
|
Thank you, @DDaemonium for this contribution. For events the best way is using I can assume that you need 2-way binding and event of value changed as the same time. If you need only 2-way binding you can go this way: https://blazorfiddle.com/s/yi2tpksf
But if you need event of changing you can not 2-way binding, because 2-way binding need one subscription and your subscription to ValueChange event. But EventCallback supports only one subscription. This will be fixed in next versions of Blazor. dotnet/aspnetcore#14365 You can go this way: https://blazorfiddle.com/s/vofr3vc1
Anyway I think new event not needed. What you think? |
Can you see the above comment? |
@Christian-Oleson , Sure, will close this PR. Thanks. |
Added OnValueChanged handler, to handle onchange action.
Currently overloading of onchange attribute of MatCheckbox has no results.