import { Injectable } from '@angular/core';

@Injectable()
export class WindowService {

  get nativeWindow() : any {
    return _window();
  }

}

function _window() : any {
  // return the global native browser window object
  return window || undefined;
}

import { Injectable } from '@angular/core';

@Injectable()
export class WindowService {

  get nativeWindow() : any {
    return _window();
  }

}

function _window() : any {
  // return the global native browser window object
  return typeof window != 'undefined' ? window : undefined;
}

Fix for window being undefined on Node.
Fix for window being undefined on Node.

This is related to the same issue #6 where if you just try use window which is undeclared on Node then Angular Universal crashes.
A simple check makes sure window is not undefined, before using it.