blob: 970c57de899cc3ca8b6537577d6b13026cfea294 [file] [log] [blame]
Michael Landoed64b5e2017-06-09 03:19:04 +03001import {BrowserModule} from '@angular/platform-browser';
2import {NgModule, APP_INITIALIZER} from '@angular/core';
3import {FormsModule} from '@angular/forms';
4import {forwardRef} from '@angular/core';
5import {AppComponent} from './app.component';
6import {UpgradeAdapter} from '@angular/upgrade';
7import {UpgradeModule} from '@angular/upgrade/static';
8import {PropertiesAssignmentModule} from './pages/properties-assignment/properties-assignment.module';
9import {
10 DataTypesServiceProvider, SharingServiceProvider, CookieServiceProvider,
Michael Landob3d48982017-06-11 14:22:02 +030011 StateParamsServiceFactory, CacheServiceProvider, EventListenerServiceProvider
Michael Landoed64b5e2017-06-09 03:19:04 +030012} from "./utils/ng1-upgraded-provider";
13import {ConfigService} from "./services/config.service";
Michael Landoed64b5e2017-06-09 03:19:04 +030014import {HttpModule} from '@angular/http';
15import {AuthenticationService} from './services/authentication.service';
16import {Cookie2Service} from "./services/cookie.service";
17import {ComponentServiceNg2} from "./services/component-services/component.service";
18import {ServiceServiceNg2} from "./services/component-services/service.service";
19import {ComponentInstanceServiceNg2} from "./services/component-instance-services/component-instance.service";
Tal Gitelmaned7e1c32017-06-29 19:30:00 +030020import { InterceptorService } from 'ng2-interceptors';
21import { XHRBackend, RequestOptions } from '@angular/http';
22import {HttpInterceptor} from "./services/http.interceptor.service";
Michael Landoed64b5e2017-06-09 03:19:04 +030023
24export const upgradeAdapter = new UpgradeAdapter(forwardRef(() => AppModule));
25
26export function configServiceFactory(config:ConfigService) {
27 return () => config.loadValidationConfiguration();
28}
29
Tal Gitelmaned7e1c32017-06-29 19:30:00 +030030export function interceptorFactory(xhrBackend: XHRBackend, requestOptions: RequestOptions){
31 let service = new InterceptorService(xhrBackend, requestOptions);
32 service.addInterceptor(new HttpInterceptor());
33 return service;
34}
35
36
Michael Landoed64b5e2017-06-09 03:19:04 +030037// export function httpServiceFactory(backend: XHRBackend, options: RequestOptions) {
38// return new HttpService(backend, options);
39// }
40
41@NgModule({
42 declarations: [
43 AppComponent
44 ],
45 imports: [
46 BrowserModule,
47 UpgradeModule,
48 FormsModule,
49 HttpModule,
50 PropertiesAssignmentModule
51 ],
52 exports: [],
53 entryComponents: [],
54 providers: [
Michael Landoed64b5e2017-06-09 03:19:04 +030055 DataTypesServiceProvider,
56 SharingServiceProvider,
57 CookieServiceProvider,
58 StateParamsServiceFactory,
Michael Landob3d48982017-06-11 14:22:02 +030059 CacheServiceProvider,
60 EventListenerServiceProvider,
Michael Landoed64b5e2017-06-09 03:19:04 +030061 AuthenticationService,
62 Cookie2Service,
63 ConfigService,
64 ComponentServiceNg2,
65 ServiceServiceNg2,
66 ComponentInstanceServiceNg2,
67 {
68 provide: APP_INITIALIZER,
69 useFactory: configServiceFactory,
70 deps: [ConfigService],
71 multi: true
Tal Gitelmaned7e1c32017-06-29 19:30:00 +030072 },
73 {
74 provide: InterceptorService,
75 useFactory: interceptorFactory,
76 deps: [XHRBackend, RequestOptions]
Michael Landoed64b5e2017-06-09 03:19:04 +030077 }
78 ],
79 bootstrap: [AppComponent]
80})
81
82
83export class AppModule {
84 // ngDoBootstrap() {}
85 constructor(public upgrade:UpgradeModule) {
86
87
88 }
89}