An optional route parameter adds URL information without making that information necessary for the route to function. Angular expresses these values with URL matrix notation: semicolon-separated name–value pairs attached to a route segment. section 24.3.2
Use optional segments when a component can improve its behavior with extra values but must still work without them:
- Use supplied values to avoid a data-model request, then retain existing values when optional inputs are absent. section 24.3.2
Editing a product with optional values
A link can produce /form/edit/2;name=Lifejacket;price=48.95. The form reads name, category, and price, replacing the loaded product fields only when corresponding optional values are provided; price is parsed as a number.
