Skip to content

MatDialog not working properly on pageload on NgUniversal (ssr) #15579

Closed
@mastermsd

Description

@mastermsd

What is the expected behavior?

MatDialog should behave the same on a ssr application

What is the current behavior?

On SSR, when MatDialog is triggered (this.dialog.open()) on pageload (ngOnInit) two <cdk-overlay-container> is generated in the DOM. When trying to close it (this.dialog.close()) only one instance is responding to it. The other one still remain in the DOM. Which leaves the user with a dialog on the screen which can not been closed.

What are the steps to reproduce?

Run your app on SSR, open MatDialog on ngOnInit.

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

"@angular-devkit/build-angular": "^0.10.1",
"@angular/animations": "^7.0.0",
"@angular/cdk": "^7.3.0",
"@angular/cli": "^7.0.0",
"@angular/common": "^7.0.0",
"@angular/compiler": "^7.0.0",
"@angular/compiler-cli": "^7.0.0",
"@angular/core": "^7.0.0",
"@angular/flex-layout": "^7.0.0-beta.19",
"@angular/forms": "^7.0.0",
"@angular/http": "^7.0.0",
"@angular/material": "^7.3.0",
"@angular/platform-browser": "^7.0.0",
"@angular/platform-browser-dynamic": "^7.0.0",
"@angular/platform-server": "^7.0.0",
"@angular/router": "^7.0.0",
"@nguniversal/express-engine": "^7.0.2",
"@nguniversal/module-map-ngfactory-loader": "^7.0.0"

MacOS Mojave (10.14.3)
Typescript 3.1.x
Node 10.13.0
Yarn 1.10.0

Affects all browsers

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