aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/main.ts
blob: 7caabe9141f38005127418feeb8505b6e3ca9b24 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import { enableProdMode, provide } from '@angular/core';
import { disableDeprecatedForms, provideForms } from '@angular/forms';
import {
  HTTP_PROVIDERS,
  RequestOptions,
  XHRBackend
} from '@angular/http';
import { bootstrap }    from '@angular/platform-browser-dynamic';
import { provideRouter } from '@angular/router';

import { routes } from './app/app.routes';
import { AuthHttp, AuthService, RestExtractor } from './app/shared';
import { AppComponent } from './app/app.component';

if (process.env.ENV === 'production') {
  enableProdMode();
}

bootstrap(AppComponent, [
  HTTP_PROVIDERS,
  provide(AuthHttp, {
    useFactory: (backend: XHRBackend, defaultOptions: RequestOptions, authService: AuthService) => {
      return new AuthHttp(backend, defaultOptions, authService);
    },
    deps: [ XHRBackend, RequestOptions, AuthService ]
  }),

  AuthService,
  RestExtractor,

  provideRouter(routes),

  disableDeprecatedForms(),
  provideForms()
]);