I have a Blazor Wasm project and when I want to inject the JSRuntime
@inject JSRuntime js
I'm getting this error: "Cannot provide a value for property 'js' on type 'BlazorApp.Pages.Page'. There is no registered service of type 'Microsoft.JSInterop.JSRuntime'"
Is JSRuntime not registered by default? How do I register it?
Thanks
You need to inject IJSRuntime
, not JSRuntime
.
Try
@inject IJSRuntime JSRuntime
and in method use JSRuntime
as object with methods.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With