36 lines
904 B
TypeScript
36 lines
904 B
TypeScript
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<any> => {
|
|
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, UCAP_NATIVE_SERVICE],
|
|
multi: true
|
|
}
|
|
]
|
|
})
|
|
export class AppProviderModule {}
|