Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Fix the driver behind crashes, sound loss and screen glitches3Repair Windows errors before they cause bigger problemsAn Angular route data resolver fetches data during navigation, before the destination route activates. The component can therefore receive essential data as part of its initial route state—but navigation waits for the resolver to finish. Use a resolver when a page needs that data to activate coherently, not as a default for every request.
How a resolver works
A resolver is a function or class that supplies route data before activation. Angular runs it as part of navigation, then makes its result available under the key configured on the route. If resolution takes time, the destination does not activate until it completes.
That makes resolvers useful for essential route data, such as the record needed to render a detail page. Optional or below-the-fold content can instead load after activation so it does not hold up the entire route. See Angular’s Data resolvers guide.
Configure a functional resolver
For new code, Angular’s guide uses a function typed as ResolveFn<T>. The resolver receives route and router-state snapshots, can obtain dependencies with inject(), and may return data synchronously or asynchronously. It can also return a RedirectCommand.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Scan for outdated or missing drivers - takes under a minuteDriver Scan →#1 Best Overall
import { inject } from '@angular/core';
import { ResolveFn } from '@angular/router';
export const userResolver: ResolveFn<User> = (route) => {
const userStore = inject(UserStore);
const userId = route.paramMap.get('id')!;
return userStore.getUser(userId);
};
Register the resolver in the route’s resolve map. The map’s property name becomes the key for the returned value:
import { Routes } from '@angular/router';
export const routes: Routes = [
{
path: 'users/:id',
component: UserDetailComponent,
resolve: { user: userResolver },
},
];
Here, the resolved value is named user. In the routed component, read it from the activated route:
Rank #2
import { ActivatedRoute } from '@angular/router';
export class UserDetailComponent {
private route = inject(ActivatedRoute);
user = this.route.snapshot.data['user'] as User;
}
Angular’s guide also demonstrates signal-based access to resolved data. The class-based Resolve<T> interface remains documented for existing applications; the ResolveFn API describes the functional form.
Execution order and data dependencies
Guards run before resolvers. Angular waits for all guards to succeed before starting resolution. In a nested route tree, parent resolvers run before child resolvers, so a child resolver can use data resolved by its parent.
Rank #3
Do not rely on the order of multiple resolver entries on the same route: Angular’s ResolveData API provides no ordering guarantee. If one result depends on another, put the dependency in a parent-child route relationship or combine the dependent work explicitly.
Choose when resolvers rerun
The default runGuardsAndResolvers policy is paramsChange. It reruns for path or route-parameter changes, but not for query-parameter changes. If the resolved data depends on a query parameter, select a policy that includes query parameters or provide a predicate. Other documented options include always and policies scoped to path parameters.
Rank #4
Set the policy according to the inputs that actually affect the returned data. For example, if changing a user ID changes the requested record, the default parameter behavior may be appropriate; if changing a filter in the query string changes the result, configure reruns accordingly. The available values and predicate form are documented in Angular’s Route API and RunGuardsAndResolvers API.
Handle resolver errors and redirects
A failed resolver can end navigation in a NavigationError. Choose where to handle failures based on whether the response is shared across the application or specific to one route:
- Central policy: use
withNavigationErrorHandlerwhen the application should apply a common response to navigation errors. - Application-level event handling: listen for
NavigationErrorrouter events when the app needs to show UI, offer retry behavior, or record navigation failures. - Route-specific recovery: catch an error in the resolver when that route has a meaningful local fallback or should redirect. Returning a
RedirectCommandsends the current navigation elsewhere.
These approaches are covered in Angular’s resolver guide and lifecycle and events guide. Select one that matches the desired failure behavior rather than allowing an unhandled failure to leave the user without a clear outcome.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Keep navigation waits manageable
Because activation waits for required resolver data, a slow request can make navigation appear stalled. Keep resolver work focused on essentials, handle failures, and consider caching where it fits the data’s freshness requirements. A reasonable timeout can prevent an indefinite wait; these are design recommendations, not performance guarantees.
Where waiting is noticeable, provide navigation progress feedback. A resolver does not eliminate the wait—it places it before route activation. Angular discusses resolver behavior and navigation handling in its Data resolvers guide.
Resolver or route resource?
Choose based on the experience the route needs. A resolver gates activation until its data is ready. Angular route resources instead provide reactive loading and error status, and the resources guide says resource work across the matched route hierarchy runs concurrently.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
| Consideration | Resolver | Route resource |
|---|---|---|
| When the route can render | After the resolved data is ready. | Can render with reactive loading status while data loads. |
| Loading and error state | Handled as part of navigation and its error handling. | Exposed through reactive status, loading, and error signals. |
| Work across matched routes | Parent resolvers run before child resolvers; same-route resolver order is not guaranteed. | The resources guide describes work across the matched route hierarchy as concurrent. |
| Refreshing data | Resolution generally runs again when navigation and the configured rerun policy call for it. | Fetching is reactive to resource dependencies. |
Use a resolver when essential data must be ready before activation. Consider a route resource when the interface should activate with reactive loading and error states. These approaches represent different navigation behavior, not a universal performance ranking. See Angular’s data fetching with resources guide.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




