Skip to content

Instantly share code, notes, and snippets.

@ismcagdas
Created January 29, 2018 12:24
Show Gist options
  • Save ismcagdas/546ce42ed7e6f7e7c96633fe6312b327 to your computer and use it in GitHub Desktop.
Save ismcagdas/546ce42ed7e6f7e7c96633fe6312b327 to your computer and use it in GitHub Desktop.
Acme.HeroShop - app.server.module.ts
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