Skip to content

[mat-dialog-close] button is called many times without even clicking the button itself. #9298

@anisabboud

Description

@anisabboud

Bug:

[mat-dialog-close] button is called many times without even clicking the button itself.

What is the expected behavior?

[mat-dialog-close] button should be called only when clicked.

What are the steps to reproduce?

  1. Go to: https://material.angular.io/components/dialog/examples and
    click the "Edit in StackBlitz" icon button.
  2. Open dialog-overview-example-dialog.html and
    replace [mat-dialog-close]="data.animal" with [mat-dialog-close]="submit()"
  3. Add submit() { console.log('submit()'); } to the bottom of dialog-overview-example.ts
  4. Click "Open in New Window" ⇒ https://emgagvlolxy.angular.stackblitz.io/
  5. Click the button to open the dialog, and check the console:
    submit() was called 8 times without clicking the button!
    Any interaction with the dialog calls it many times more.
    (E.g., typing "dog" in the textbox calls submit() 16 more times.)

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

Angular 5.1.3
Angular Material 5.0.2

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