Skip to content

Add 'beforeClose' Observable to MdDialogRef #5209

@wulfsberg

Description

@wulfsberg

Bug, feature request, or proposal:

Feature request

What is the expected behavior?

Being able to start processing instantly when a user selects an option in an MdDialog.

What is the current behavior?

An 'afterClose' Observable is available which only fires after all animations are done.

What are the steps to reproduce?

The behavior is easily seen on the "Examples" page of https://material.angular.io/components/component/dialog

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

In many cases, a dialog functions as a confirmation for some additional processing (such as deleting an item), which in turn asynchronously updates the interface (say, removing the item from a list once deleted serverside).
Having to wait for an animation to finish before launching the async server call introduces unnecessary latency in the UI.

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

Material 2.0.0-beta.6

Is there anything else we should know?

Delaying until after animation is a deliberate choice, as described here: #3890, but I find that reacting instantly is also a reasonable behavior, so I propose an Observable for each.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P4A relatively minor issue that is not relevant to core functionsfeatureThis issue represents a new feature or feature request rather than a bug or bug fix

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions