A route constraint enforces type matching on a route segment to a component.
In the following example, the route to the Users component only matches if:
- An Id route segment is present on the request URL.
- The Id segment is an integer (int).
@page "/Route"
@page "/Route/{id:int}"
<h3>Routing Id: @Id</h3>
@code {
[Parameter]
public int Id { get; set; }
}
Reference link:
https://docs.microsoft.com/en-us/aspnet/core/blazor/routing?view=aspnetcore-3.1
Share with