import { NgModule, APP_INITIALIZER } from '@angular/core'; import { RESOLVERS } from './resolvers'; import { SERVICES } from './services'; import { AppService } from './services/app.service'; import { HttpClient } from '@angular/common/http'; import { UCAP_NATIVE_SERVICE } from '@ucap-webmessenger/native'; import { environment } from '../environments/environment'; export function initializeApp(appService: AppService) { return (): Promise => { return appService.postInit(); }; } @NgModule({ imports: [], exports: [], providers: [ ...SERVICES, ...RESOLVERS, { provide: UCAP_NATIVE_SERVICE, useClass: environment.modules.native.serviceClass, deps: [HttpClient] }, { provide: APP_INITIALIZER, useFactory: initializeApp, deps: [AppService], multi: true } ] }) export class AppProviderModule {}