mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-10-01 14:41:32 +00:00
AAE-36484 Replace provideAppInitializer with APP_INITIALIZER for Angular 18 compatibility
This commit is contained in:
@@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { inject, provideAppInitializer, Provider, EnvironmentProviders } from '@angular/core';
|
import { inject, Provider, APP_INITIALIZER } from '@angular/core';
|
||||||
import { StoragePrefixFactory } from './app-config-storage-prefix.factory';
|
import { StoragePrefixFactory } from './app-config-storage-prefix.factory';
|
||||||
import { loadAppConfig } from './app-config.loader';
|
import { loadAppConfig } from './app-config.loader';
|
||||||
import { AppConfigService } from './app-config.service';
|
import { AppConfigService } from './app-config.service';
|
||||||
@@ -27,17 +27,19 @@ import { AdfHttpClient } from '@alfresco/adf-core/api';
|
|||||||
*
|
*
|
||||||
* @returns An array of providers to initialize the application configuration.
|
* @returns An array of providers to initialize the application configuration.
|
||||||
*/
|
*/
|
||||||
export function provideAppConfig(): (Provider | EnvironmentProviders)[] {
|
export function provideAppConfig(): Provider[] {
|
||||||
return [
|
return [
|
||||||
StoragePrefixFactory,
|
StoragePrefixFactory,
|
||||||
provideAppInitializer(() => {
|
{
|
||||||
const initializerFn = loadAppConfig(
|
provide: APP_INITIALIZER,
|
||||||
inject(AppConfigService),
|
useFactory: () => {
|
||||||
inject(StorageService),
|
const appConfigService = inject(AppConfigService);
|
||||||
inject(AdfHttpClient),
|
const storageService = inject(StorageService);
|
||||||
inject(StoragePrefixFactory)
|
const httpClient = inject(AdfHttpClient);
|
||||||
);
|
const prefixFactory = inject(StoragePrefixFactory);
|
||||||
return initializerFn();
|
return () => loadAppConfig(appConfigService, storageService, httpClient, prefixFactory)();
|
||||||
})
|
},
|
||||||
|
multi: true
|
||||||
|
}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user