Open Closed

Adding HeadOutlet RootComponent to Blazor Templates #4531


User avatar
0
jbrus created

Would it be possible to add the RootComponent type HeadOutlet to the Blazor template projects in future releases so that the component works right away?

private static void ConfigureUI(WebAssemblyHostBuilder builder)
{
  builder.RootComponents.Add<App>("#ApplicationContainer"); 
  builder.RootComponents.Add<HeadOutlet>("head::after"); 
}

2 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    I will check it

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    It's working as expected

    private static void ConfigureUI(WebAssemblyHostBuilder builder)
    {
        builder.RootComponents.Add<App>("#ApplicationContainer");
        builder.RootComponents.Add<HeadOutlet>("head::after");
    }
    
    @page "/"
    @using Volo.Abp.MultiTenancy
    @inherits MyProjectNameComponentBase
    @inject AuthenticationStateProvider AuthenticationStateProvider
    <div class="container">
        <h1>Control content</h1>
        <p>
            Title: @title
        </p>
    
        <p>
            Description: @description
        </p>
    
        <PageTitle>@title</PageTitle>
    
        <HeadContent>
            <meta name="description" content="@description">
        </HeadContent>
    
        @code {
            private string description = "Description set by component";
            private string title = "Title set by component";
        }
    
    </div>
    
Made with ❤️ on ABP v9.1.0-preview. Updated on December 13, 2024, 06:09