Q:

How do you handle the parameter in routing in Blazor?

0

This code will help you to understand how to handle the parameter in routing in Blazor

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

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; }
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now