@page "/nettojs"
@inject IJSRuntime jsRuntime
This is a demo how to call JavaScript from .NET
@code {
protected async void ShowAlert()
{
IJSObjectReference jsRef = await jsRuntime.InvokeAsync("import", "/_content/Components/Pages/JSInteropSamples/NetToJS.razor.js");
await jsRef.InvokeVoidAsync("showAlert", "Hello from .NET");
}
}