Skip to content

TypeError when closing a Modal #759

@Gorzas

Description

@Gorzas

Describe the bug
When I try to close a modal clicking outside it, the console throws an error and it doesn't calls the action to close in the controller. I think it's a problem with the latest versions of Ember and the compatibility with the library modal-dialog.

This is because this.get('onClose') in model-dialog is a string instead a function.

To Reproduce
Steps to reproduce the behavior:

  1. Open a md-modal.
  2. Click outside the modal.
  3. In the console, you're going to see the following: TypeError: this.get(...) is not a function.

Expected behavior
It should call the controller action.

Desktop (please complete the following information):

  • Browser Chrome 73 and Firefox
  • Ember 3.4.4

Additional context
I think that's going to need to remove sendAction in the following lines. Like this:

  cancel() {
    this.close();
  },

  actions: {
    closeModal() {
      this.close();
    }
}

Not tested. Could it have some problem with older Ember versions? The change is very little so I'm going to make and discuss about it after being done.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions