Open CoSJay opened 4 years ago
@CoSJay I'm most accustomed to client-side blzr, let me look into the problem for server side. Thanks!
Hi peter,
do you have any solution, blazor server side web assembly.
https://github.com/peterblazejewicz/blazor-beforeunload/issues/2
please let me know that will be great help.
can't promise, I need to refresh local stack, tbu
Please help me on blazor server. Error. Some services are not able to be constructed (Error while validating the service descriptor 'ServiceType: blazejewicz.Blazor.BeforeUnload.BeforeUnload Lifetime: Singleton ImplementationType: blazejewicz.Blazor.BeforeUnload.BeforeUnload': Cannot consume scoped service 'Microsoft.JSInterop.IJSRuntime' from singleton 'blazejewicz.Blazor.BeforeUnload.BeforeUnload'.)
@jmarinl which version of .net you're on at the moment? (note, this one was never run properly on server-backed blazor version)
Replacing services.AddBeforeUnload();
with services.AddScoped<BeforeUnload>()
removes the exception, however the callback doesn't get run when navigating off the page.
Hi, has anyone found a solution?
Bump This looks like a perfect solution to what I'm trying to do right now, but am running into the same issue as @girlpunk
Has anyone found a solution to using this in a blazor server?
The new dotnet 7 updates regarding blazor implement
Starting from ASP .NET 7 you no longer needs to use an external library to do so. You could use the built-in event notifier and component:
More info at MS Docs
This is exactly what I need (I have no idea why the Blazor folk didn't include it!), but as client-side Blazor isn't released yet we can't use it for production apps -- we're doing everything server-side. Any thought to making this SSB-friendly?