diff options
Diffstat (limited to 'client/src/main.ts')
-rw-r--r-- | client/src/main.ts | 49 |
1 files changed, 17 insertions, 32 deletions
diff --git a/client/src/main.ts b/client/src/main.ts index 7caabe914..70bf48537 100644 --- a/client/src/main.ts +++ b/client/src/main.ts | |||
@@ -1,35 +1,20 @@ | |||
1 | import { enableProdMode, provide } from '@angular/core'; | 1 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; |
2 | import { disableDeprecatedForms, provideForms } from '@angular/forms'; | 2 | import { decorateModuleRef } from './app/environment'; |
3 | import { | 3 | import { bootloader } from '@angularclass/hmr'; |
4 | HTTP_PROVIDERS, | 4 | /* |
5 | RequestOptions, | 5 | * App Module |
6 | XHRBackend | 6 | * our top level module that holds all of our components |
7 | } from '@angular/http'; | 7 | */ |
8 | import { bootstrap } from '@angular/platform-browser-dynamic'; | 8 | import { AppModule } from './app'; |
9 | import { provideRouter } from '@angular/router'; | ||
10 | 9 | ||
11 | import { routes } from './app/app.routes'; | 10 | /* |
12 | import { AuthHttp, AuthService, RestExtractor } from './app/shared'; | 11 | * Bootstrap our Angular app with a top level NgModule |
13 | import { AppComponent } from './app/app.component'; | 12 | */ |
14 | 13 | export function main(): Promise<any> { | |
15 | if (process.env.ENV === 'production') { | 14 | return platformBrowserDynamic() |
16 | enableProdMode(); | 15 | .bootstrapModule(AppModule) |
16 | .then(decorateModuleRef) | ||
17 | .catch(err => console.error(err)); | ||
17 | } | 18 | } |
18 | 19 | ||
19 | bootstrap(AppComponent, [ | 20 | bootloader(main); |
20 | HTTP_PROVIDERS, | ||
21 | provide(AuthHttp, { | ||
22 | useFactory: (backend: XHRBackend, defaultOptions: RequestOptions, authService: AuthService) => { | ||
23 | return new AuthHttp(backend, defaultOptions, authService); | ||
24 | }, | ||
25 | deps: [ XHRBackend, RequestOptions, AuthService ] | ||
26 | }), | ||
27 | |||
28 | AuthService, | ||
29 | RestExtractor, | ||
30 | |||
31 | provideRouter(routes), | ||
32 | |||
33 | disableDeprecatedForms(), | ||
34 | provideForms() | ||
35 | ]); | ||