title: Angular 7 SSR loading first time twice
body: <p>I have several sites built in <code>Angular 7</code> with <code>SSR</code> for <code>SEO</code> improvements. All apps themselves are fine however it always happens that either <strong>the very first time</strong> or when you perform a <strong>hard refresh</strong> there is this small <em>blip</em> whereby all content is shown and suddenly the site itself "reloads".</p>
  
  <p>All conditions for <code>ngIf</code>'s that may hide components that are evaluated in the <code>ngOnInit</code> section of the components seem to be ignored and animations that may start with <code>opacity = 0</code> to hide HTML elements are also shown.</p>
  
  <p>That said I read a lot regarding this in different forums, posts, github issues etc however I haven't been able to get to any solution.</p>
  
  <p>I tried changing the <code>main.ts</code> to have:</p>
  
  <pre><code>document.addEventListener('DOMContentLoaded', () =&gt; {
      platformBrowserDynamic().bootstrapModule(AppModule);
  });
  </code></pre>
  
  <p>instead of the classic bootstrap mechanism for no joy. I have tried the option for the <code>initialNavigation</code> enabled in the <code>AppRouting</code> but still doesn't work:</p>
  
  <pre><code>@NgModule({
      exports: [ RouterModule ],
      imports: [ RouterModule.forRoot(routes, {enableTracing, scrollPositionRestoration: 'enabled', initialNavigation: 'enabled'}) ],
  })
  export class AppRoutingModule {}
  </code></pre>
  
  <p>I read through the issue here which I thought it may be related:
  <a href="https://github.com/angular/angular-cli/issues/7477" rel="nofollow noreferrer">https://github.com/angular/angular-cli/issues/7477</a> but it ends referring to the initialNavigation flag which hasn't worked for me.</p>
  
  <p>I'm not sure if there is anything else that I could try here or anything "special" to be set up but it would be really nice to have no delay or hide the actual rendered page which is causing the navigation to be a bit less friendly.</p>
  
  <p>Note that this is JUST on the first load, first time load or hard refresh. The rest of the navigation is absolutely fine.</p>