Skip to content

Commit

Permalink
fix(common): only use window if available
Browse files Browse the repository at this point in the history
This makes ui-router usable server side for Angular Universal
  • Loading branch information
ocombe committed Apr 6, 2016
1 parent 54e4ac9 commit 32ff988
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/common/common.ts
Expand Up @@ -7,7 +7,8 @@
import {isFunction, isString, isArray, isRegExp, isDate} from "./predicates";
import { all, any, not, prop, curry } from "./hof";

let angular = (<any> window).angular || {};
let w: any = typeof window === 'undefined' ? {} : window;
let angular = w.angular || {};
export const fromJson = angular.fromJson || JSON.parse.bind(JSON);
export const toJson = angular.toJson || JSON.stringify.bind(JSON);
export const copy = angular.copy || _copy;
Expand Down

0 comments on commit 32ff988

Please sign in to comment.