title: Angular isPlatformBrowser checking against PLATFORM_ID doesn't prevent server-side pre rendering
body: <p>I am trying to compile Angular 4 + ASP.NET Universal application created based on sample project here, using this hints <a href="https://github.com/angular/universal#universal-gotchas" rel="nofollow noreferrer">https://github.com/angular/universal#universal-gotchas</a>
  and when I build project with webpack, and then run it there is error thrown as the code that was encapsulated inside if block checked against</p>
  <blockquote>
  <p>isPlatformBrowser</p>
  </blockquote>
  <p><strong>was prerendered on server side</strong>. How to effectively enforce execution of this code on client side without prerendering, while other code that works appropriately with server side pre rendering leave to be pre rendered on there server-side?</p>
  <p>Here's my Component with Leaflet code encapsulated inside conditional block checking whether platform is Browser or not.</p>
  <pre class="lang-js prettyprint-override"><code>import {Component, OnInit, Inject} from '@angular/core';
  import { PLATFORM_ID } from '@angular/core';
  import { isPlatformBrowser, isPlatformServer } from '@angular/common';
  import * as L from 'leaflet';
  
  
  @Component({
      selector: 'leaflet-map',
      templateUrl: 'leaflet-map.component.html',
      styleUrls: ['leaflet-map.component.css', '../../../..//node_modules/leaflet/dist/leaflet.css'],
  })
  export class LeafletMapComponent implements OnInit { 
  
      constructor(@Inject(PLATFORM_ID) private _platformId: Object) {  }
  
      ngAfterViewInit() { 
  
         
      }
  
      ngOnInit() {  
          if (isPlatformBrowser(this._platformId)) {
               L.map('leafletMap').setView([50.08, 19.93], 13);
          }
          if (isPlatformServer(this._platformId)) {
              // Server only code.
              // https://github.com/angular/universal#universal-gotchas
          }
      }
    
  }
  </code></pre>