next-ucap-messenger/projects/ucap-webmessenger-app/src/app/app-provider.module.ts

36 lines
883 B
TypeScript
Raw Normal View History

2019-09-19 01:40:16 +00:00
import { NgModule, APP_INITIALIZER } from '@angular/core';
2019-09-18 06:02:21 +00:00
2019-09-19 05:15:43 +00:00
import { RESOLVERS } from './resolvers';
2019-09-19 01:40:16 +00:00
import { SERVICES } from './services';
import { AppService } from './services/app.service';
2019-11-11 06:53:39 +00:00
import { HttpClient } from '@angular/common/http';
import { UCAP_NATIVE_SERVICE } from '@ucap-webmessenger/native';
import { environment } from '../environments/environment';
2019-09-19 01:40:16 +00:00
export function initializeApp(appService: AppService) {
return (): Promise<any> => {
return appService.postInit();
};
}
2019-09-18 06:02:21 +00:00
@NgModule({
imports: [],
exports: [],
providers: [
...SERVICES,
2019-09-19 05:15:43 +00:00
...RESOLVERS,
2019-11-11 06:53:39 +00:00
{
provide: UCAP_NATIVE_SERVICE,
useClass: environment.modules.native.serviceClass,
deps: [HttpClient]
},
2019-09-19 01:40:16 +00:00
{
provide: APP_INITIALIZER,
useFactory: initializeApp,
deps: [AppService],
multi: true
2019-11-11 06:53:39 +00:00
}
2019-09-18 06:02:21 +00:00
]
})
export class AppProviderModule {}