This code will help you to understand how to implement the routing constraints in Blazor.
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:
@page "/Route" @page "/Route/{id:int}" <h3>Routing Id: @Id</h3> @code { [Parameter] public int Id { get; set; } }
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
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).
need an explanation for this answer? contact us directly to get an explanation for this answer