Andersen
Andersen

Reputation: 41

NavigationManager issue

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

Answers (1)

Mister Magoo
Mister Magoo

Reputation: 9029

You need to inject an instance of the NavigationManager

@inject NavigationManager navigationManager

Then you can use it

navigationManager.NavigateTo("...")

Upvotes: 0

Related Questions