Skip to main content
InterviewHubPRO
Section Overview
Q137

Question 137 of 283

Part 6: Decorators, Dependency Injection & Tooling (124 - 150)

48%
Angular Master (283 Qs)•Part 6: Decorators, Dependency Injection & Tooling (124 - 150)

What happens if I import the same module twice?

mid LevelMost AskedCode ExampleDependency InjectionTypeScript

If multiple modules imports the same module then angular evaluates it only once (When it encounters the module first time). It follows this condition even the module appears at any level in a hierarchy of imported NgModules.

Practical Code Example

text
// Importing the same module twice:
// Angular processes the module only once. Singleton services are created only once per injector.