From 79f67d5a7f09e5b1fc366e1a30df0aaf3c7a24f6 Mon Sep 17 00:00:00 2001 From: crisbeto Date: Sat, 2 Dec 2017 16:21:15 +0100 Subject: [PATCH] fix(layout): handle platforms that don't support matchMedia Adds an extra check to ensure that the current platform supports `window.matchMedia`. Fixes #8710. --- src/cdk/layout/media-matcher.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cdk/layout/media-matcher.ts b/src/cdk/layout/media-matcher.ts index 2079aa1004f8..98ebd75cae3a 100644 --- a/src/cdk/layout/media-matcher.ts +++ b/src/cdk/layout/media-matcher.ts @@ -20,7 +20,7 @@ export class MediaMatcher { private _matchMedia: (query: string) => MediaQueryList; constructor(private platform: Platform) { - this._matchMedia = this.platform.isBrowser ? + this._matchMedia = this.platform.isBrowser && window.matchMedia ? // matchMedia is bound to the window scope intentionally as it is an illegal invocation to // call it from a different scope. window.matchMedia.bind(window) :