Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/soenneker/soenneker.blazor.utils.navigation
A Blazor WebAssembly library that features navigate back, login/logout, reload and more
https://github.com/soenneker/soenneker.blazor.utils.navigation
blazor csharp dotnet navigation utils
Last synced: about 8 hours ago
JSON representation
A Blazor WebAssembly library that features navigate back, login/logout, reload and more
- Host: GitHub
- URL: https://github.com/soenneker/soenneker.blazor.utils.navigation
- Owner: soenneker
- License: mit
- Created: 2023-04-28T00:17:10.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-05-22T15:33:46.000Z (8 months ago)
- Last Synced: 2024-05-22T16:46:54.910Z (8 months ago)
- Topics: blazor, csharp, dotnet, navigation, utils
- Language: C#
- Homepage: https://soenneker.com
- Size: 351 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
[![](https://img.shields.io/nuget/v/Soenneker.Blazor.Utils.Navigation.svg?style=for-the-badge)](https://www.nuget.org/packages/Soenneker.Blazor.Utils.Navigation/)
[![](https://img.shields.io/github/actions/workflow/status/soenneker/soenneker.blazor.utils.navigation/publish-package.yml?style=for-the-badge)](https://github.com/soenneker/soenneker.blazor.utils.navigation/actions/workflows/publish-package.yml)
[![](https://img.shields.io/nuget/dt/Soenneker.Blazor.Utils.Navigation.svg?style=for-the-badge)](https://www.nuget.org/packages/Soenneker.Blazor.Utils.Navigation/)# ![](https://user-images.githubusercontent.com/4441470/224455560-91ed3ee7-f510-4041-a8d2-3fc093025112.png) Soenneker.Blazor.Utils.Navigation
Can work side-by-side existing Blazor [NavigationManager](https://learn.microsoft.com/en-us/aspnet/core/blazor/fundamentals/routing?view=aspnetcore-7.0) usage, and still work with navigate back
## Installation
```
dotnet add package Soenneker.Blazor.Navigation
```## Usage
1. Register `INavigationUtil` within `Program.cs` or wherever your registering your services:
```csharp
public static async Task Main(string[] args)
{
...
builder.Services.AddNavigationUtil();
}
```2. Warm it up so it can begin recording navigation history. Call after the `WebAssemblyHost` has been built:
```csharp
public static async Task Main(string[] args)
{
...
WebAssemblyHost host = builder.Build();host.Services.WarmupNavigation();
}
```3. Inject `INavigationUtil` within pages/components where you need to access navigation methods:
```csharp
@using Soenneker.Blazor.Navigation.Abstract
@inject INavigationUtil NavigationUtil
```### Navigating back
```csharp
NavigationUtil.NavigateBack();
```### Navigating
```csharp
// within the SPA client
NavigationUtil.NavigateTo("/users");// forcing a page load
NavigationUtil.NavigateTo("/users", true);
```