Skip to content

[mat-input] SSR crashes because of undefined functions #11603

@arturovt

Description

@arturovt

Bug, feature request, or proposal:

Bug

What is the expected behavior?

monitor and stopMonitoring methods should be defined

What is the current behavior?

Angular universal crashes with these errors
TypeError: this._autofillMonitor.monitor is not a function at MatInput.ngOnInit
TypeError: this._autofillMonitor.stopMonitoring is not a function at MatInput.ngOnDestroy

What are the steps to reproduce?

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

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

Angular 6.0.3

Is there anything else we should know?

I opened @angular/material/bundles/material-input.umd.js, found ngOnInit hook and added console.log(typeof this._autofillMonitor.monitor);, same with stopMonitoring
It printed two values - undefined and function, because this directive is instantiated twice, once on the server and on the client.

Metadata

Metadata

Assignees

No one assigned

    Labels

    blockedThis issue is blocked by some external factor, such as a prerequisite PR

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions