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