Resolvers and Route Data
Preload data before activating a route.
What is a resolver
A resolver pre-fetches data before a route activates, so the component renders with data already available — no loading flash in the component itself.
Static route data
The data property attaches static values to a route, readable via ActivatedRoute.data.
export const routes = [
{ path: 'admin', component: AdminComponent,
data: { title: 'Admin Panel', roles: ['admin'] } }
];All lessons in this course
- Route Parameters and Query Params
- Resolvers and Route Data
- Functional Route Guards
- Router Events and Navigation