The parameters can be defined using curly braces within a routing template in both the @page directive and RouteAttribute.
Using @page directive
@page "/Route"
@page "/Route/{id}"
<h3>Routing Id: @Id</h3>
@code {
[Parameter]
public string Id { get; set; }
}
Using RouteAttribue
[Route("/Route/{id}")]
public class BaseComponent: ComponentBase
{
public string Id { get; set; }
}
Reference link:
https://docs.microsoft.com/en-us/aspnet/core/blazor/routing?view=aspnetcore-3.1
Share with