Angular 4.4.6
Angular CLI 1.3.2
Node 6.x.x
NPM 3.10.10
Webpack 3.4.1
In Angular Universal application when server view sift to client view there is
Edit: this solution is for angular 5
When I had the flickering problem I just added BrowserTransferStateModule to the client app
//app.module.ts
import {BrowserModule, BrowserTransferStateModule} from '@angular/platform-browser';
imports: [
//...
BrowserModule.withServerTransition({appId: 'my-app'}),
BrowserTransferStateModule,
then ServerTransferStateModule to the server app
//app.server.module.ts
import {ServerModule, ServerTransferStateModule} from '@angular/platform-server';
//...
imports: [
AppModule,
ServerModule,
ServerTransferStateModule
And I modified main.ts to boostrap the app once the dom is loaded
//main.ts
document.addEventListener('DOMContentLoaded', () => {
platformBrowserDynamic().bootstrapModule(AppModule)
.catch(err => console.log(err));
});
I did not use APP_BOOTSTRAP_LISTENER like you did (not sure if it makes a difference)