You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
routes to the viewpost page for both of these routes:
/viewpost
'viewpost/test'
I have tested this with both SS and CS Blazor and it worked correctly.
Would suggest the following:
Remove this paragraph:
Optional parameters aren't supported. Two @page directives are applied in the previous example. The first permits navigation to the component without a parameter. The second @page directive takes the {text} route parameter and assigns the value to the Text property.
Replace with:
Optional parameters are supported by Blazor on both Server and WebAssemebly appss. Two @page directives are applied in the previous example. To reduce to one, use this syntax: @page "/RouteParameter/{text?}. This will match both /RouteParameter and /RouteParameter/optional. The first route sets the Text parameter to null (or the default value if provided as in this example), while the second route sets it to optional.
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
ID: 35474d24-8039-f04a-de14-1530b8e8506c
Version Independent ID: b6cb2574-6326-a40d-0b6c-d1661328e828
This page says "Optional parameters aren't supported."
This is no longer true. See #19733
I have tested and it works great.
For example:
@page "/viewpost/{code?}"
routes to the
viewpost
page for both of these routes:/viewpost
'viewpost/test'
I have tested this with both SS and CS Blazor and it worked correctly.
Would suggest the following:
Remove this paragraph:
Optional parameters aren't supported. Two @page directives are applied in the previous example. The first permits navigation to the component without a parameter. The second @page directive takes the {text} route parameter and assigns the value to the Text property.
Replace with:
Optional parameters are supported by Blazor on both Server and WebAssemebly appss. Two @page directives are applied in the previous example. To reduce to one, use this syntax:
@page "/RouteParameter/{text?}
. This will match both/RouteParameter
and/RouteParameter/optional
. The first route sets the Text parameter tonull
(or the default value if provided as in this example), while the second route sets it tooptional
.Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
The text was updated successfully, but these errors were encountered: