@inject IJSRuntime _runtime;
<Button Clicked="OnUniClick">
<Figure Size="FigureSize.Is128x128" Rounded>
<FigureImage Source="@Logo" AlternateText="@Name" />
<FigureCaption>@Name</FigureCaption>
</Figure>
</Button>
@code {
[Parameter]
public string Logo { get; set; }
[Parameter]
public string Name { get; set; }
public async Task OnUniClick()
{
Console.WriteLine("Clicked");
await _runtime.InvokeVoidAsync("alert", "This is a test alert");
}
}
neither the Console.WriteLine or the alert execute when the button is clicked. This is my first time using blazor and I am just trying to get a javascript alert to pop up. I believe that I am following everything described in these three posts: https://learn.microsoft.com/en-us/aspnet/core/blazor/javascript-interoperability/?view=aspnetcore-8.0 https://learn.microsoft.com/en-us/aspnet/core/blazor/components/event-handling?view=aspnetcore-8.0
https://blazorise.com/docs/components/button
Im sure its some stupid thing that I am missing but if anyone could please help me out that would be very appreciated.