In the code behind razor.cs file, IJSRunTime
or others can be injected with the [Inject]
attribute
public partial class BillingDashboard
{
[Inject]
IJSRuntime JSRuntime { get; set; }
protected override async Task MyFunction()
{
await JSRuntime.InvokeVoidAsync("console.log('test')");
}
}