liveBook · Manning

Resolve property

As explained in Pro Angular 16

The resolve property is an Angular route configuration property that associates names with resolver functions whose results are obtained before route activation.

The resolve property associates route names with resolver functions and delays route activation until the resolver’s result is ready. Its map keys are arbitrary; the values determine which resolvers run. section 26.2.1

Configure a resolver by:

  • Registering the resolver service in the feature module. section 26.2.1
  • Adding a resolve map to the route, such as { model: mapToResolve(ModelResolver) }. section 26.2.1
  • Placing the property on a parent route when several child routes require the same data. section 26.2.1
  • Returning an Observable, Promise, or other result; navigation waits for the first two and proceeds immediately for other results. section 26.2.1

Load the model before product routes activate

A parent route can apply resolve: { model: mapToResolve(ModelResolver) } to product and category child routes. The resolver waits until products arrive, preventing the table from appearing empty; a message service can display loading feedback meanwhile. section 26.2.1

How Pro Angular 16 covers it

How deep it goes
Explains resolver registration, route maps, parent-route reuse, result types, and loading feedback without detailing router internals.
Examples
Uses a ModelResolver, product and category routes, delayed product data, and a loading message.
What it assumes
Assumes route configuration and services, while introducing resolver registration, result handling, and parent-route application.
What you can do after
Operate/configure Angular routes that wait for model data and provide loading feedback during navigation.
How it connects
Connects route resolvers with route activation, child routes, services, Observables, Promises, and message services.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Pro Angular 16. The section links point to the parts of the book it draws on.