Skip to content

Commit 32ff988

Browse files
committed
fix(common): only use window if available
This makes ui-router usable server side for Angular Universal
1 parent 54e4ac9 commit 32ff988

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/common/common.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
import {isFunction, isString, isArray, isRegExp, isDate} from "./predicates";
88
import { all, any, not, prop, curry } from "./hof";
99

10-
let angular = (<any> window).angular || {};
10+
let w: any = typeof window === 'undefined' ? {} : window;
11+
let angular = w.angular || {};
1112
export const fromJson = angular.fromJson || JSON.parse.bind(JSON);
1213
export const toJson = angular.toJson || JSON.stringify.bind(JSON);
1314
export const copy = angular.copy || _copy;

0 commit comments

Comments
 (0)