I am trying to implement the Notification service in my Blazor app.
I have the imports in _Imports.razor:
@using Radzen
@using Radzen.Blazor
This in my Program.cs:
builder.Services.AddScoped<NotificationService>();
In my _Layout.cshtml:
Bottom of <link rel="stylesheet" href="_content/Radzen.Blazor/css/default-base.css">
Bottom of <script src="_content/Radzen.Blazor/Radzen.Blazor.js"></script>
In my razor components:
@inject NotificationService notificationService
...
<RadzenButton Text="Save" Click=@(args => Save(new NotificationMessage { Severity = NotificationSeverity.Success, Summary = "Success Summary", Detail = "Success Detail", Duration = 40000 })) />
...
private async Task Save(NotificationMessage message)
{
try
{
await userManager.UpdateAsync(User);
notificationService.Notify(message);
}
catch
{
}
}
There are no errors and nothing in the browser console but the notification doesn't show up.