Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

add multiple blazor components to dependency injection

$
0
0

Pretty new to Blazor and asp.net core as well.

I am reading through asp.net documentation dependency injection.

I am able to register an initial component MyCounter.razor file and import it into my ui framework.

   app.MapRazorComponents<Prodigy.Dashboards.Components.Chart>()   .AddInteractiveServerRenderMode();   app.MapRazorComponents<Prodigy.Dashboards.Components.Counter>()   .AddInteractiveServerRenderMode();``````services.AddServerSideBlazor(options =>{   options.RootComponents.RegisterCustomElement<Counter>("my-counter");   options.RootComponents.RegisterCustomElement<Chart>("my-chart");});```I have the ability to see counter in as <my-counter></my-counter>When i go to use ```<my-chart></my-chart>```// That is unavailable and errors out in vscode and chrome.  I haven't found all of the documentation on blazor to this point that.  But what i am trying to figure out if this is limited to one razor component or if this is something that i can add multiple components to? I am looking for access to both **Chart** and **Counter** componets.  But I want to use them separately not looking to have a parent child relationship with them.  

Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>