provideEnvironmentInitializer
함수
안정화
This function is used to provide initialization functions that will be executed upon construction of an environment injector.
@paraminitializerFn
() => void@returns
EnvironmentProviders설명
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.
사용 시 참고사항
The following example illustrates how to configure an initialization function using
provideEnvironmentInitializer()
createEnvironmentInjector(
[
provideEnvironmentInitializer(() => {
console.log('environment initialized');
}),
],
parentInjector
);
상세 내용으로 이동