Skip to main content
InterviewHubPRO
Section Overview
Q218

Question 218 of 283

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

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

Why is not necessary to use entryComponents array every time?

mid LevelCode ExampleDependency InjectionComponentsData Structures

Most of the time, you don't need to explicitly to set entry components in entryComponents array of ngModule decorator. Because angular adds components from both @NgModule.bootstrap and route definitions to entry components automatically.

Practical Code Example

text
// Why entryComponents array is unnecessary:
// The Ivy compiler automatically detects dynamically created components without explicit declarations.