https://github.com/liebki/navigationmanagerutils
A very simple injectable service for Blazor or MAUI, to enhance the NavigationManager by a few simple things.
https://github.com/liebki/navigationmanagerutils
asp-net blazor csharp dotnet dotnet-maui maui-blazor navigationmanager web
Last synced: 4 months ago
JSON representation
A very simple injectable service for Blazor or MAUI, to enhance the NavigationManager by a few simple things.
- Host: GitHub
- URL: https://github.com/liebki/navigationmanagerutils
- Owner: liebki
- License: gpl-3.0
- Created: 2023-02-10T14:24:51.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2025-01-22T13:25:16.000Z (over 1 year ago)
- Last Synced: 2025-10-20T05:23:44.185Z (8 months ago)
- Topics: asp-net, blazor, csharp, dotnet, dotnet-maui, maui-blazor, navigationmanager, web
- Language: C#
- Homepage: https://www.nuget.org/packages/NavigationManagerUtils
- Size: 227 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# NavigationManagerUtils
## Overview
**NavigationManagerUtils** is a very simple injectable service, created to enhance the capabilities of the `NavigationManager` in Blazor applications. It provides additional utility methods that simplify navigation and URL parameter management.
---
## Technologies Used
- **.NET Core 8.0**
---
## Features
### What is NavigationManagerUtils?
This is an injectable service for Blazor applications that builds upon the standard `NavigationManager`, adding commonly-used features for navigation and URL management.
### Example Usage
To see this utility in action, refer to the `NavManUtilTest` project—a simple Blazor Server application that demonstrates its functionality.
---
## Getting Started
### Installation
Add the service to your application during configuration:
```csharp
builder.Services.AddTransient();
```
### Injecting the Service
1. **In Code**
Use the `[Inject]` attribute:
`[Inject] private NavManUtils NavMan { get; set; }`
2. **In Razor Components**
Use the `@inject` directive:
`@inject NavManUtils NavMan`
---
## Available Methods
1. **`Navigate(string url, bool force = true)`**
Navigate to the specified URL. The `force` parameter determines whether to reload the page even if already on the target URL.
2. **`[DEPRECATED] Reload(bool force = true)`**
Reload the current page. The `force` parameter determines whether to reload from the server.
3. **`UrlHasParameters()`**
Returns `true` if the current URL contains query parameters, otherwise `false`.
4. **`GetUrlParameters(bool removeWhitespaceEntityInValue = false, bool removeWhitespaceEntityInKey = false)`**
Retrieves the query parameters from the current URL as a `Dictionary`.
- `removeWhitespaceEntityInValue`: Strips %20 whitespace entities from parameter values.
- `removeWhitespaceEntityInKey`: Strips %20 whitespace entities from parameter keys.
5. **`GetNavMan()`**
Provides access to the underlying `NavigationManager` instance without requiring separate injection.
---
## License
This project is licensed under the **GNU General Public License v3.0**. For more details, visit [GNU License](https://choosealicense.com/licenses/gpl-3.0/).
---