October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk2 min

Angular PLATFORM_INITIALIZER: What It Does and How to Migrate

Angular deprecated PLATFORM_INITIALIZER in v19. Learn its platform scope, the replacement API, and when app initialization should use provideAppInitializer.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

PLATFORM_INITIALIZER is Angular’s deprecated platform-level initialization token. Since Angular 19, use providePlatformInitializer for platform setup; use provideAppInitializer when initialization belongs to an individual application. The distinction matters because the APIs run at different injector scopes, and only the app initializer is documented to wait for a returned Promise or Observable.

What PLATFORM_INITIALIZER does

PLATFORM_INITIALIZER represents callbacks that run when Angular initializes the platform injector. Angular describes the platform as the entry point for a page; its injector is the parent injector for every Angular application on that page. That makes this token appropriate for work associated with the platform rather than setup belonging to one application. See Angular’s PLATFORM_INITIALIZER API and PlatformRef API.

As an Amazon Associate I earn from qualifying purchases.

The token’s documented type is InjectionToken<readonly (() => void)[]>. Angular marks it deprecated since v19.0 and names providePlatformInitializer as its replacement.

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

How to migrate to providePlatformInitializer

Replace a PLATFORM_INITIALIZER registration with providePlatformInitializer, and register the helper as part of platform creation. Angular documents the helper as a () => void callback that runs in an injection context.

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

const platformRef = platformBrowser([
  providePlatformInitializer(() => {
    // Platform-level setup
  }),
]);

This follows Angular’s documented registration point: the initializer is passed to platformBrowser([...]) while creating the platform. The resulting platform reference can then be used to bootstrap an application. Consult the providePlatformInitializer API for the current signature and example.

Choose the initializer by scope

API Scope and registration Completion behavior
providePlatformInitializer Platform injector; register during platform creation. Documented callback type is () => void; the API documentation does not describe waiting for an asynchronous result.
provideAppInitializer Application startup; provide it in application providers. If the callback returns a Promise or Observable, Angular waits for it to resolve or complete before finishing application initialization.

Use the app-level helper for tasks such as loading language data or external configuration needed by a particular application. Angular marks the older APP_INITIALIZER token deprecated since v19.0 in favor of provideAppInitializer; it is not the direct replacement for platform initialization. See provideAppInitializer and APP_INITIALIZER.

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

Does a platform initializer wait for asynchronous work?

Do not treat providePlatformInitializer as an asynchronous startup barrier based on its documented API. Angular specifies a void-returning callback and does not document awaiting a Promise or Observable for this helper. If application startup must wait for asynchronous work, use provideAppInitializer and return the Promise or Observable from its callback.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

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

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.