Skip to content

Cdk DialogRef.afterClosed is called twice #11398

@jpzwarte

Description

@jpzwarte

Bug, feature request, or proposal:

const dialogRef = this.dialog.openFromComponent(FooComponent);
dialogRef.afterClosed().subscribe(() => console.log('close'));

The above code logs "close" twice. From debugging i can see that the _onAnimationDone callback in cdk-dialog-container.ts is called twice.

What is the expected behavior?

It should emit an afterClosed once.

What is the current behavior?

Emits afterClosed twice.

What are the steps to reproduce?

https://angular-material2-issue-s2bybt.stackblitz.io

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

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

6.0.*

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