Skip to content

Instantly share code, notes, and snippets.

@trnktms
Created January 13, 2021 15:27
Embed
What would you like to do?
public class ChildrenBlock : ViewComponent
{
private readonly IViewModelBinder _viewModelBinder;
public ChildrenBlock(IViewModelBinder viewModelBinder)
{
_viewModelBinder = viewModelBinder;
}
public async Task<IViewComponentResult> InvokeAsync()
{
return View(
"~/Views/Shared/Components/SitecoreComponent/ChildrenBlock.cshtml",
await _viewModelBinder.Bind<ChildrenBlockModel>(this.ViewContext));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment