@@ -2,7 +2,10 @@ import { NgModule, Inject } from '@angular/core';
22import { RouterModule , PreloadAllModules } from '@angular/router' ;
33import { CommonModule , APP_BASE_HREF } from '@angular/common' ;
44import { HttpModule , Http } from '@angular/http' ;
5+ import { HttpClientModule , HttpClient } from '@angular/common/http' ;
56import { FormsModule } from '@angular/forms' ;
7+ import { BrowserModule , BrowserTransferStateModule } from '@angular/platform-browser' ;
8+ import { TransferHttpCacheModule } from '@nguniversal/common' ;
69
710import { Ng2BootstrapModule } from 'ngx-bootstrap' ;
811
@@ -16,17 +19,14 @@ import { HomeComponent } from './containers/home/home.component';
1619import { UsersComponent } from './containers/users/users.component' ;
1720import { UserDetailComponent } from './components/user-detail/user-detail.component' ;
1821import { CounterComponent } from './containers/counter/counter.component' ;
19- // import { ChatComponent } from './containers/chat/chat.component';
2022import { NotFoundComponent } from './containers/not-found/not-found.component' ;
2123import { NgxBootstrapComponent } from './containers/ngx-bootstrap-demo/ngx-bootstrap.component' ;
2224
2325import { LinkService } from './shared/link.service' ;
2426import { UserService } from './shared/user.service' ;
25- // import { ConnectionResolver } from './shared/route.resolver';
26- import { ORIGIN_URL } from './shared/constants/baseurl.constants' ;
27- import { TransferHttpModule } from '../modules/transfer-http/transfer-http.module' ;
27+ import { ORIGIN_URL } from '@nguniversal/aspnetcore-engine' ;
2828
29- export function createTranslateLoader ( http : Http , baseHref ) {
29+ export function createTranslateLoader ( http : HttpClient , baseHref ) {
3030 // Temporary Azure hack
3131 if ( baseHref === null && typeof window !== 'undefined' ) {
3232 baseHref = window . location . origin ;
@@ -43,24 +43,28 @@ export function createTranslateLoader(http: Http, baseHref) {
4343 UsersComponent ,
4444 UserDetailComponent ,
4545 HomeComponent ,
46- // ChatComponent,
4746 NotFoundComponent ,
4847 NgxBootstrapComponent
4948 ] ,
5049 imports : [
5150 CommonModule ,
52- HttpModule ,
51+ BrowserModule . withServerTransition ( {
52+ appId : 'my-app-id' // make sure this matches with your Server NgModule
53+ } ) ,
54+ HttpClientModule ,
55+ TransferHttpCacheModule ,
56+ BrowserTransferStateModule ,
57+
58+
5359 FormsModule ,
5460 Ng2BootstrapModule . forRoot ( ) , // You could also split this up if you don't want the Entire Module imported
5561
56- TransferHttpModule , // Our Http TransferData method
57-
5862 // i18n support
5963 TranslateModule . forRoot ( {
6064 loader : {
6165 provide : TranslateLoader ,
6266 useFactory : ( createTranslateLoader ) ,
63- deps : [ Http , [ ORIGIN_URL ] ]
67+ deps : [ HttpClient , [ ORIGIN_URL ] ]
6468 }
6569 } ) ,
6670
@@ -145,9 +149,9 @@ export function createTranslateLoader(http: Http, baseHref) {
145149 providers : [
146150 LinkService ,
147151 UserService ,
148- // ConnectionResolver,
149152 TranslateModule
150- ]
153+ ] ,
154+ bootstrap : [ AppComponent ]
151155} )
152156export class AppModuleShared {
153157}
0 commit comments