dotnet / AspNetCore.Docs

Documentation for ASP.NET Core
https://docs.microsoft.com/aspnet/core
Creative Commons Attribution 4.0 International
12.64k stars 25.29k forks source link

Callback method as a parameter. #17411

Closed bdnts closed 4 years ago

bdnts commented 4 years ago

Following on to mrlife's question, passing callback methods to components is perfectly legal in Blazor. Is this supported when calling a component from a View? The use case is a modal dialog with a Save and Cancel button. When clicked, the corresponding callback method fires back in the Model. <component type="typeof(ZipCodeModal)" render-mode="Serverprerendered" param-Save="@Model.Save" param-Cancel="@Model.Cancel" /> which, of course does not work.
A) Is it possible to pass a method parameter? B) If it is, what is the correct declarations and syntax? TIA.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

guardrex commented 4 years ago

That would be good feedback for the product unit. Open on the engineering repo :point_right: https://github.com/dotnet/aspnetcore/issues