Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

PLATFORM_INITIALIZER is Angular’s platform-level initialization token, but it has been deprecated since Angular 19.0. For platform setup, use providePlatformInitializer while creating the platform. If the work belongs to an individual application’s startup—and must finish before initialization completes—use provideAppInitializer instead.

What PLATFORM_INITIALIZER does

Angular runs platform initializers when it initializes the platform injector. A platform is the entry point for a page, and its injector is the parent injector for every Angular application on that page. That makes this API appropriate for work shared at the platform level, rather than setup belonging to just one application. See Angular’s PlatformRef documentation.

The legacy token is typed as InjectionToken<readonly (() => void)[]>. Angular marks PLATFORM_INITIALIZER deprecated since v19.0 and identifies providePlatformInitializer as its replacement. See the PLATFORM_INITIALIZER API reference.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How to migrate to providePlatformInitializer

Replace the token-based registration with providePlatformInitializer, and register the callback in the platform creation configuration. Angular documents the helper as accepting an () => void callback and returning a StaticProvider. The callback runs in an injection context.

import { providePlatformInitializer } from '@angular/core';
import { platformBrowser } from '@angular/platform-browser';

const platformRef = platformBrowser([
  providePlatformInitializer(() => {
    // Perform platform-level initialization.
  }),
]);

The key placement is the array passed to platformBrowser: the initializer is configured as the platform is created, not added to an individual app’s providers. Angular’s providePlatformInitializer API reference shows this pattern.

Choose the initializer by scope and completion behavior

API Scope and registration point Completion behavior
providePlatformInitializer Platform scope; register during platform creation. Documented callback type is () => void. The API documentation does not describe waiting for an asynchronous result.
provideAppInitializer Application scope; runs during application initialization. Angular waits for a returned Promise to resolve or an Observable to complete before finishing application initialization.

Use provideAppInitializer for app-start work such as loading language data or external configuration when startup needs to wait for that work. Its callback also runs in an injection context. Consult Angular’s provideAppInitializer API reference for its behavior and examples.

Do not substitute APP_INITIALIZER simply because it is another initializer token. It is application-level, not the direct replacement for PLATFORM_INITIALIZER; Angular deprecated it since v19.0 in favor of provideAppInitializer. See the APP_INITIALIZER API reference.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

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.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi