provideEnvironmentInitializer
This function is used to provide initialization functions that will be executed upon construction of an environment injector.
provideEnvironmentInitializer
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.
() => void
EnvironmentProviders
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);