How to intercept oninitialized and onafterrender in each blazor component ?

Gustavo Siqueira 1 Reputation point
2022-02-07T18:57:03.58+00:00

Hi guys! I'm currently working on Blazor Server project. I need to create a spinner indicator to my user when the component it is changed (route). So, I think to create a component and call it in OnInitialize then stop in OnAfterRender. I would like to make in each component of my project automatically, without have that make manually.

How I do ?
Thanks in advance

Developer technologies | .NET | Blazor
{count} votes

2 answers

Sort by: Most helpful
  1. Jose Zero 576 Reputation points
    2022-02-07T20:23:04.537+00:00

    At a first moment I don´t see how to do it automatically, perhaps a nested component.
    I the mean time, did you checked BlazorPro.Spinkit it is available at nuget as well.
    Also found this video watch

    1 person found this answer helpful.
    0 comments No comments

  2. Gustavo Siqueira 1 Reputation point
    2022-02-07T21:43:58.99+00:00

    Hi, @Jose Zero ,
    So, I think to create my own class component base, then, I can do:

    OnInitializedAsync {  
      //loading start  
    }  
      
    OnAfterRenderAsync {  
      // loading stop  
    }  
     
    
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.