ENVIRONMENT_INITIALIZER is deprecated in Angular 19.0. For a synchronous callback that should run when an environment injector is constructed, use provideEnvironmentInitializer. For application-startup work that must wait for a Promise or Observable, use provideAppInitializer instead.
What ENVIRONMENT_INITIALIZER does
ENVIRONMENT_INITIALIZER is an @angular/core injection token for callbacks executed when an environment injector is constructed. Its type is InjectionToken<readonly (() => void)[]>. Angular marks the token deprecated since v19.0 and recommends provideEnvironmentInitializer for this lifecycle scope. Angular API reference
As an Amazon Associate I earn from qualifying purchases.
This is injector-construction work, not a general-purpose synonym for every task performed during application bootstrap. Choose an initializer according to the lifecycle that owns the work.
Free tools Windows power users keep installed
One-click scans. No signup required.
How to migrate to provideEnvironmentInitializer
Replace the legacy token provider with Angular’s helper in the provider list for the environment injector. The helper’s callback runs in an injection context, so it can use dependency injection there. Angular API reference
#1 Best Overall
import { createEnvironmentInjector, provideEnvironmentInitializer } from '@angular/core';
const injector = createEnvironmentInjector([
provideEnvironmentInitializer(() => {
// Synchronous work for this environment injector
}),
], parentInjector);
Angular documents provideEnvironmentInitializer as returning EnvironmentProviders, with a callback signature of () => void. Its documented example supplies the helper in the provider array passed to createEnvironmentInjector. Angular API reference
If you still use the legacy token
The token is a multi-provider token. If you retain its old provider form, include multi: true; omitting it can cause Angular’s NG0209 invalid multi-provider error. New code should use the replacement helper. Angular NG0209 documentation
Rank #2
{
provide: ENVIRONMENT_INITIALIZER,
multi: true,
useValue: () => {
// Environment-injector initialization work
},
}
Choose the initializer that matches the lifecycle
| When the work should run | API | What it does |
|---|---|---|
| When an environment injector is constructed | provideEnvironmentInitializer |
Runs a synchronous callback in an injection context. |
| During application startup, with asynchronous work to finish first | provideAppInitializer |
If the callback returns a Promise or Observable, application initialization waits for the Promise to resolve or the Observable to complete. Angular API reference |
| When the platform injector is initialized | providePlatformInitializer |
Provides a callback at platform level during platform creation. Angular API reference |
These APIs have similar names but different lifecycle scopes. In particular, the documented environment initializer accepts a synchronous () => void callback; use the application initializer when startup must await a Promise or Observable.
Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchPC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11What Angular’s deprecation means
The API reference records deprecation beginning in Angular v19.0, but does not name a removal release for ENVIRONMENT_INITIALIZER. Angular’s general policy says deprecated APIs remain available through at least the next major release and may be removed only in a later major release. That policy does not establish a token-specific removal date. Angular release policy
Quick Recap
Rank #4
Rank #3
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




