Skip to content

Commit

Permalink
Fix for window being undefined on Node.
Browse files Browse the repository at this point in the history
This is related to the same issue MurhafSousli#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.
  • Loading branch information
Gerard A Lamusse committed Jan 9, 2017
1 parent 71f99f9 commit 2ec14cc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/service/window.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ export class WindowService {

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

0 comments on commit 2ec14cc

Please sign in to comment.