Skip to content

Commit 11e871c

Browse files
committed
docs: show a redirect function in the route metadata guide
The redirect routes section only showed string targets.
1 parent a4ebd6f commit 11e871c

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

  • apps/docs-analog/src/content/features/routing

‎apps/docs-analog/src/content/features/routing/metadata.md‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,15 @@ Nested redirects always require an absolute path.
7474

7575
:::
7676

77+
`redirectTo` also accepts Angular's `RedirectFunction`, which receives the matched route's params, query params and data, can use `inject()`, and returns the target path or a `UrlTree`:
78+
79+
```ts
80+
export const routeMeta: RouteMeta = {
81+
redirectTo: ({ params }) => `/cities/${params['cityId']}`,
82+
pathMatch: 'full',
83+
};
84+
```
85+
7786
## Route Meta Tags
7887

7988
The `RouteMeta` type has a property `meta` which can be used to define a list of meta tags for each route:

0 commit comments

Comments
 (0)