Michael Lando | dd60339 | 2017-07-12 00:54:52 +0300 | [diff] [blame] | 1 | /*- |
| 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 Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 21 | import {BrowserModule} from '@angular/platform-browser'; |
| 22 | import {NgModule, APP_INITIALIZER} from '@angular/core'; |
| 23 | import {FormsModule} from '@angular/forms'; |
| 24 | import {forwardRef} from '@angular/core'; |
| 25 | import {AppComponent} from './app.component'; |
| 26 | import {UpgradeAdapter} from '@angular/upgrade'; |
| 27 | import {UpgradeModule} from '@angular/upgrade/static'; |
| 28 | import {PropertiesAssignmentModule} from './pages/properties-assignment/properties-assignment.module'; |
| 29 | import { |
| 30 | DataTypesServiceProvider, SharingServiceProvider, CookieServiceProvider, |
Michael Lando | b3d4898 | 2017-06-11 14:22:02 +0300 | [diff] [blame] | 31 | StateParamsServiceFactory, CacheServiceProvider, EventListenerServiceProvider |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 32 | } from "./utils/ng1-upgraded-provider"; |
| 33 | import {ConfigService} from "./services/config.service"; |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 34 | import {HttpModule} from '@angular/http'; |
| 35 | import {AuthenticationService} from './services/authentication.service'; |
| 36 | import {Cookie2Service} from "./services/cookie.service"; |
| 37 | import {ComponentServiceNg2} from "./services/component-services/component.service"; |
| 38 | import {ServiceServiceNg2} from "./services/component-services/service.service"; |
| 39 | import {ComponentInstanceServiceNg2} from "./services/component-instance-services/component-instance.service"; |
Tal Gitelman | ed7e1c3 | 2017-06-29 19:30:00 +0300 | [diff] [blame] | 40 | import { InterceptorService } from 'ng2-interceptors'; |
| 41 | import { XHRBackend, RequestOptions } from '@angular/http'; |
| 42 | import {HttpInterceptor} from "./services/http.interceptor.service"; |
Michael Lando | 39a4e0c | 2017-07-18 20:46:42 +0300 | [diff] [blame] | 43 | import { SearchBarComponent } from './shared/search-bar/search-bar.component'; |
| 44 | import { SearchWithAutoCompleteComponent } from './shared/search-with-autocomplete/search-with-autocomplete.component'; |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 45 | |
| 46 | export const upgradeAdapter = new UpgradeAdapter(forwardRef(() => AppModule)); |
| 47 | |
| 48 | export function configServiceFactory(config:ConfigService) { |
| 49 | return () => config.loadValidationConfiguration(); |
| 50 | } |
| 51 | |
Tal Gitelman | ed7e1c3 | 2017-06-29 19:30:00 +0300 | [diff] [blame] | 52 | export function interceptorFactory(xhrBackend: XHRBackend, requestOptions: RequestOptions){ |
| 53 | let service = new InterceptorService(xhrBackend, requestOptions); |
| 54 | service.addInterceptor(new HttpInterceptor()); |
| 55 | return service; |
| 56 | } |
| 57 | |
| 58 | |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 59 | // export function httpServiceFactory(backend: XHRBackend, options: RequestOptions) { |
| 60 | // return new HttpService(backend, options); |
| 61 | // } |
| 62 | |
| 63 | @NgModule({ |
| 64 | declarations: [ |
Michael Lando | 39a4e0c | 2017-07-18 20:46:42 +0300 | [diff] [blame] | 65 | AppComponent, |
| 66 | SearchBarComponent, |
| 67 | SearchWithAutoCompleteComponent |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 68 | ], |
| 69 | imports: [ |
| 70 | BrowserModule, |
| 71 | UpgradeModule, |
| 72 | FormsModule, |
| 73 | HttpModule, |
| 74 | PropertiesAssignmentModule |
| 75 | ], |
| 76 | exports: [], |
Michael Lando | 39a4e0c | 2017-07-18 20:46:42 +0300 | [diff] [blame] | 77 | entryComponents: [SearchWithAutoCompleteComponent], |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 78 | providers: [ |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 79 | DataTypesServiceProvider, |
| 80 | SharingServiceProvider, |
| 81 | CookieServiceProvider, |
| 82 | StateParamsServiceFactory, |
Michael Lando | b3d4898 | 2017-06-11 14:22:02 +0300 | [diff] [blame] | 83 | CacheServiceProvider, |
| 84 | EventListenerServiceProvider, |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 85 | AuthenticationService, |
| 86 | Cookie2Service, |
| 87 | ConfigService, |
| 88 | ComponentServiceNg2, |
| 89 | ServiceServiceNg2, |
| 90 | ComponentInstanceServiceNg2, |
| 91 | { |
| 92 | provide: APP_INITIALIZER, |
| 93 | useFactory: configServiceFactory, |
| 94 | deps: [ConfigService], |
| 95 | multi: true |
Tal Gitelman | ed7e1c3 | 2017-06-29 19:30:00 +0300 | [diff] [blame] | 96 | }, |
| 97 | { |
| 98 | provide: InterceptorService, |
| 99 | useFactory: interceptorFactory, |
| 100 | deps: [XHRBackend, RequestOptions] |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 101 | } |
| 102 | ], |
| 103 | bootstrap: [AppComponent] |
| 104 | }) |
| 105 | |
| 106 | |
| 107 | export class AppModule { |
| 108 | // ngDoBootstrap() {} |
| 109 | constructor(public upgrade:UpgradeModule) { |
| 110 | |
| 111 | |
| 112 | } |
| 113 | } |