Skip to content

Commit

Permalink
docs(router): Document missing input for route binding
Browse files Browse the repository at this point in the history
This commit clearly documents the approach used by router input binding
when an input is not present in the route data.

resolves angular#52946
  • Loading branch information
atscott committed Sep 9, 2024
1 parent fc95a9a commit 64b8f8c
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions packages/router/src/provide_router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -730,6 +730,24 @@ export type ViewTransitionsFeature = RouterFeature<RouterFeatureKind.ViewTransit
* );
* ```
*
* The router bindings information from any of the following sources:
*
* - query parameters
* - path and matrix parameters
* - static route data
* - data from resolvers
*
* Duplicate keys are resolved in the same order from above, from least to greatest,
* meaning that resolvers have the highest precedence and override any of the other information
* from the route.
*
* Importantly, when an input does not have an item in the route data with a matching key, this
* input is set to `undefined`. This prevents previous information from being
* retained if the data got removed from the route (i.e. if a query parameter is removed).
* Default values can be provided with a resolver on the route to ensure the value is always present
* or an input and use an input transform in the component.
*
* @see {@link guide/components/inputs#input-transforms input transforms}
* @returns A set of providers for use with `provideRouter`.
*/
export function withComponentInputBinding(): ComponentInputBindingFeature {
Expand Down

1 comment on commit 64b8f8c

@dailytabs
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The router bindings information

binds?

Please sign in to comment.