Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

385
Views
How to inject in blazor code behind .razor.cs file? IJSRuntime for example

With a normal single page razor component in Blazor. I can inject IJSRuntime like this at the top of the page:

@inject IJSRuntime JSRuntime

If I create a code behind .razor.cs file for the component, how do I inject something like IJSRuntime into the code behind file?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

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')");
    }
}
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!