Configurations loaded by the Blazor WebAssembly can be accessed by injecting IConfiguration services. Using IConfiguration, the values from wwwroot/appsettings.json and wwwroot/appsettings.{ENVIRONMENT}.json files can be accessed.
wwwroot/appsettings.json
{
"message": "Blazor is awesome."
}
Index.razor
@inject Microsoft.Extensions.Configuration.IConfiguration config
<span>@config["message"]</span>
More information about configuration can be found here.
Share with