GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Docs
  • Tutorials
  • Playground
  • Reference
  • code
  • ENVIRONMENT_INITIALIZER

This view

  • Original page
  • New address

GeezerVison is showing next.angular.dev — provideEnvironmentInitializer • Angular

API

function provideEnvironmentInitializer(
  initializerFn: () => void,
): EnvironmentProviders;
@paraminitializerFn() => void
@returnsEnvironmentProviders

Description

This function is used to provide initialization functions that will be executed upon construction of an environment injector.

Note that the provided initializer is run in the injection context.

Previously, this was achieved using the ENVIRONMENT_INITIALIZER token which is now deprecated.

Usage Notes

The following example illustrates how to configure an initialization function using provideEnvironmentInitializer()

createEnvironmentInjector(
  [
    provideEnvironmentInitializer(() => {
      console.log('environment initialized');
    }),
  ],
  parentInjector
);
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.