@page "/route-parameter/{text?}" <h1>Blazor is @Text!</h1> @code { [Parameter] public string? Text { get; set; } protected override void OnInitialized() { Text = Text ?? "fantastic"; } }
@page "/user/{Id:int}/{Option:bool?}" <p> Id: @Id </p> <p> Option: @Option </p> @code { [Parameter] public int Id { get; set; } [Parameter] public bool Option { get; set; } }
Constraint | Example | Example Matches | Invariant culture matching |
---|---|---|---|
bool |
{active:bool} |
true , FALSE |
No |
datetime |
{dob:datetime} |
2016-12-31 , 2016-12-31 7:32pm |
Yes |
decimal |
{price:decimal} |
49.99 , -1,000.01 |
Yes |
double |
{weight:double} |
1.234 , -1,001.01e8 |
Yes |
float |
{weight:float} |
1.234 , -1,001.01e8 |
Yes |
guid |
{id:guid} |
CD2C1638-1638-72D5-1638-DEADBEEF1638 , {CD2C1638-1638-72D5-1638-DEADBEEF1638} |
No |
int |
{id:int} |
123456789 , -123456789 |
Yes |
long |
{ticks:long} |
123456789 , -123456789 |
Yes |