Angular Outlet Injector

Outlet Injector is a special type of injector in angular created by router outlets.

Outlet injectors are the one that injects activated route and children outlet contexts. This injector acts as an intermediary to traverse further up in the element injector hierarchy.

Outlet Injector

As stated in the previous article,

Whenever resolving a dependency from a hosted component in a router-outlet will first check its element injector, If the dependency is not found then traverse up the element injector hierarchy and once it reaches the OutletInjector It will be further navigated to the element injectors hierarchy that resides outside the router outlet.

If it is not found in the element injectors hierarchy then it will fall back to the module injector hierarchy from the Outlet Injector.

References: Angular source (https://github.com/angular/angular)

--

--

Ramanathan Chockalingam
Ramanathan Chockalingam

No responses yet