Skip to content

Cannot read property 'bind' of undefined at new MediaMatcher #8710

@Gorniv

Description

@Gorniv

Bug

When I use the material for my universal project, I have this problem:
exception:

TypeError: Cannot read property 'bind' of undefined
    at new MediaMatcher (C:\GitHub\AngularMigration-Init\angular2\server.js:137690:30)
    at _createClass (C:\GitHub\AngularMigration-Init\angular2\server.js:15506:20)

source

var MediaMatcher = (function () {
    function MediaMatcher(platform) {
        this.platform = platform;
        this._matchMedia = this.platform.isBrowser ?
            // 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) :
            noopMatchMedia;
    }

What is the expected behavior?

no error

What is the current behavior?

error

What are the steps to reproduce?

https://github.com/Angular-RU/angular-universal-starter/tree/material2
npm run ssr:debug
open http://localhost:4000/material

What is the use-case or motivation for changing an existing behavior?

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

"@angular/cli": "1.6.0-rc.0",
"@angular/core": "5.0.3",
"@angular/material": "5.0.0-rc.2",
"typescript": "2.4.2"

Is there anything else we should know?

Metadata

Metadata

Assignees

Labels

P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions