Blazor doesn’t consider the word casing and it just assigns the value if the name is matched.
@page "/RouteParameter"
@page "/RouteParameter/{name}"
<h1>Welcome to blazor : @Name !!!</h1>
@code {
[Parameter]
public string Name { get; set; }
protected override void OnInitialized()
{
Name = Name ?? "David";
}
}
The router parses the name
parameter from the URL and sets the value of the component. For instance, if the URL is /RouteParameter/JonSnow
, the Name
property will be set to “ JonSnow
“.
Share with