Reputation: 406
I looked around for quite a while but found no satisfying result. I want to use normal Razor Pages within .Net Core MVC. I used Angular before to enrich my Views for UI functionality. I do not need a SPA, I just want to use C# code for UI modification. Can I use Blazor in any way just to use C# code for client side interactions instead of Javascript/Angular (etc.) and still render most of my views on the server just like normal MVC?
Thanks in advance.
Upvotes: 1
Views: 665
Reputation: 308
Yes, you can!
It is a well-documented scenario. Prerender and integrate ASP.NET Core Razor components
Basicaly you want to do something like that:
@using BlazorHosted.Client.Pages
<h1>@ViewData["Title"]</h1>
<component type="typeof(Counter)" render-mode="WebAssemblyPrerendered" />
@section Scripts {
<script src="_framework/blazor.webassembly.js"></script>
}
Upvotes: 1