Skip to content

Commit dd612fc

Browse files
committed
feat(router): add readRouteData
1 parent f4ac42a commit dd612fc

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

  • packages/router/src/route-data

packages/router/src/route-data/use.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@ export function useRouteData<T>(
3232
);
3333
}
3434

35+
export function readRouteData<T>(
36+
data: Data,
37+
token: RouteDataToken<T>,
38+
): T | undefined {
39+
return data[token.key];
40+
}
41+
3542
function aggregateRouteTreeData(root: ActivatedRoute): Observable<Data> {
3643
const observables: Observable<Data>[] = [root.data];
3744
for (const child of root.children)

0 commit comments

Comments
 (0)