Reputation: 41
I'm trying to use NavigationManager.NavigateTo("...") in Blazor WebAssembly C# and according to many sources it's correct, but IDE shows mistake and says that for non-static methods I need to create an instance of this class. Would appreciate any ideas about solving that problem.
Upvotes: 2
Views: 495
Reputation: 9029
You need to inject an instance of the NavigationManager
@inject NavigationManager navigationManager
Then you can use it
navigationManager.NavigateTo("...")
Upvotes: 0