InterviewHubPRO
Section Overview
Q255

Question 255 of 283

Part 9: NgModules, Providers, NgZone & Injector Hierarchies (213 - 255)

90%
Angular & Signals (283 Qs)•Part 9: NgModules, Providers, NgZone & Injector Hierarchies (213 - 255)

What are the types of injector hierarchies?

There are two types of injector hierarchies in Angular

  1. ModuleInjector hierarchy: It configure on a module level using an @NgModule() or @Injectable() annotation.
  2. ElementInjector hierarchy: It created implicitly at each DOM element. Also it is empty by default unless you configure it in the providers property on @Directive() or @Component().

Practical Code Example

text
// Injector Hierarchies:
// 1. EnvironmentInjector Hierarchy (Root, Platform, Null)
// 2. ElementInjector Hierarchy (Component DOM tree)