blob: 09b40e920f7e0e73e988f3974b612b278bf3917b [file] [log] [blame]
Michael Landodd603392017-07-12 00:54:52 +03001/*-
2 * ============LICENSE_START=======================================================
3 * SDC
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
19 */
20
Michael Landoed64b5e2017-06-09 03:19:04 +030021import {BrowserModule} from '@angular/platform-browser';
22import {NgModule, APP_INITIALIZER} from '@angular/core';
23import {FormsModule} from '@angular/forms';
24import {forwardRef} from '@angular/core';
25import {AppComponent} from './app.component';
26import {UpgradeAdapter} from '@angular/upgrade';
27import {UpgradeModule} from '@angular/upgrade/static';
28import {PropertiesAssignmentModule} from './pages/properties-assignment/properties-assignment.module';
29import {
30 DataTypesServiceProvider, SharingServiceProvider, CookieServiceProvider,
Michael Landob3d48982017-06-11 14:22:02 +030031 StateParamsServiceFactory, CacheServiceProvider, EventListenerServiceProvider
Michael Landoed64b5e2017-06-09 03:19:04 +030032} from "./utils/ng1-upgraded-provider";
33import {ConfigService} from "./services/config.service";
Michael Landoed64b5e2017-06-09 03:19:04 +030034import {HttpModule} from '@angular/http';
35import {AuthenticationService} from './services/authentication.service';
36import {Cookie2Service} from "./services/cookie.service";
37import {ComponentServiceNg2} from "./services/component-services/component.service";
38import {ServiceServiceNg2} from "./services/component-services/service.service";
39import {ComponentInstanceServiceNg2} from "./services/component-instance-services/component-instance.service";
Tal Gitelmaned7e1c32017-06-29 19:30:00 +030040import { InterceptorService } from 'ng2-interceptors';
41import { XHRBackend, RequestOptions } from '@angular/http';
42import {HttpInterceptor} from "./services/http.interceptor.service";
Michael Landoed64b5e2017-06-09 03:19:04 +030043
44export const upgradeAdapter = new UpgradeAdapter(forwardRef(() => AppModule));
45
46export function configServiceFactory(config:ConfigService) {
47 return () => config.loadValidationConfiguration();
48}
49
Tal Gitelmaned7e1c32017-06-29 19:30:00 +030050export function interceptorFactory(xhrBackend: XHRBackend, requestOptions: RequestOptions){
51 let service = new InterceptorService(xhrBackend, requestOptions);
52 service.addInterceptor(new HttpInterceptor());
53 return service;
54}
55
56
Michael Landoed64b5e2017-06-09 03:19:04 +030057// export function httpServiceFactory(backend: XHRBackend, options: RequestOptions) {
58// return new HttpService(backend, options);
59// }
60
61@NgModule({
62 declarations: [
63 AppComponent
64 ],
65 imports: [
66 BrowserModule,
67 UpgradeModule,
68 FormsModule,
69 HttpModule,
70 PropertiesAssignmentModule
71 ],
72 exports: [],
73 entryComponents: [],
74 providers: [
Michael Landoed64b5e2017-06-09 03:19:04 +030075 DataTypesServiceProvider,
76 SharingServiceProvider,
77 CookieServiceProvider,
78 StateParamsServiceFactory,
Michael Landob3d48982017-06-11 14:22:02 +030079 CacheServiceProvider,
80 EventListenerServiceProvider,
Michael Landoed64b5e2017-06-09 03:19:04 +030081 AuthenticationService,
82 Cookie2Service,
83 ConfigService,
84 ComponentServiceNg2,
85 ServiceServiceNg2,
86 ComponentInstanceServiceNg2,
87 {
88 provide: APP_INITIALIZER,
89 useFactory: configServiceFactory,
90 deps: [ConfigService],
91 multi: true
Tal Gitelmaned7e1c32017-06-29 19:30:00 +030092 },
93 {
94 provide: InterceptorService,
95 useFactory: interceptorFactory,
96 deps: [XHRBackend, RequestOptions]
Michael Landoed64b5e2017-06-09 03:19:04 +030097 }
98 ],
99 bootstrap: [AppComponent]
100})
101
102
103export class AppModule {
104 // ngDoBootstrap() {}
105 constructor(public upgrade:UpgradeModule) {
106
107
108 }
109}