Angular · Senior · Question 19 of 75
How do you load configuration before the app renders?
providers: [
provideAppInitializer(() => inject(ConfigService).load()),
]- ✓Correct answer:
provideAppInitializerwith a function returning a Promise or Observable that delays bootstrap - 2Load it in the root component's
ngOnInit- it always runs before rendering - 3Use a resolver on the
**route
Explanation
Bootstrap waits for initializers to finish. Keep them fast and handle errors: a failed initializer blocks the whole application from starting.