Search code examples
blazor-webassembly

Pass paramenter to root component Blazor Assembly


I have a visual Basic project that will render Blazor Assembly as new feature . I have successfully intergrated together and run them quite smoothly. But I need to pass one string as token such as GUID from parent VB project to blazor directly to root app component.

I am looking a way like :

<app @bind="token" />

or <app TokenModel="token/>

Thank !


Solution

  • App is the root component, there's no component parent to pass in token. I suggest you use a service to make token available to App from wherever you're getting it. Inject the service into App and then read the value in OnInitialized.