Created
January 29, 2018 12:24
-
-
Save ismcagdas/546ce42ed7e6f7e7c96633fe6312b327 to your computer and use it in GitHub Desktop.
Acme.HeroShop - app.server.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { NgModule } from '@angular/core'; | |
import { ServerModule } from '@angular/platform-server'; | |
import { AppModule } from './app.module'; | |
import { AppComponent } from './app.component'; | |
import { ServerTransferStateModule } from '../modules/transfer-state/server-transfer-state.module'; | |
import { TransferState } from '../modules/transfer-state/transfer-state'; | |
@NgModule({ | |
imports: [ | |
// The AppServerModule should import your AppModule followed | |
// by the ServerModule from @angular/platform-server. | |
AppModule, | |
ServerModule, | |
ServerTransferStateModule | |
], | |
// Since the bootstrapped component is not inherited from your | |
// imported AppModule, it needs to be repeated here. | |
bootstrap: [AppComponent], | |
}) | |
export class AppServerModule { | |
constructor(private transferState: TransferState) { } | |
ngOnBootstrap = () => { | |
this.transferState.inject(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment