Skip to content

Opening MdDialog in ngOnInit throws ExpressionChangedAfterItHasBeenCheckedError #5268

@fredrikredflag

Description

@fredrikredflag

Bug:

When opening a MdDialog inside ngOnInit of a component a ExpressionChangedAfterItHasBeenCheckedError error is thrown. If the MdDialog is opened in the constructor of a component no error is thrown.

Temp workaround is to open the MdDialog inside a setTimeout(() => this._dialog.open(MyComponent))

What are the steps to reproduce?

http://plnkr.co/edit/aE6LNzRVYnKB01bMej87?p=preview

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

This only seems occur with material-beta.7 and angular 4.2.0+.

Works fine with material-beta.7 and angular 4.1.3.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions