Application behavior

Dependency injection

Inspect which injector supplies a token when a component has a local provider or falls back to its environment.

Angular 22.3.2 · trace
Lesson flow Provide. Resolve. Inspect scopes. Result.
Provide
Resolve
Inspect scopes
Result

Objective

Predict the scope of a provider and observe how lookup modifiers change the result.

Transcript

Angular 22.3.2

  1. An InjectionToken identifies a dependency. A provider binds that token to a value, factory, or class.
  2. The element injector can shadow a value from the environment injector for the component and its descendants.
  3. With no matching element provider, ordinary injection can reach the environment. The fixture checks both scopes using the same token.
  4. Optional self lookup returns null when the current element has no provider. Skip-self begins above the current element.

Sources