feat(dialog): Pass an observable to the mat-dialog-close directive #20571
Labels
area: material/dialog
feature
This issue represents a new feature or feature request rather than a bug or bug fix
Feature Description
It would be great if we could pass an Observable into the
mat-dialog-close
directive so that the dialog can be closed when the observable emits.Use Case
In our codebase, we use many dialog components for filling up forms. These components usually have the following actions:
The
save
method usually makes an HTTP POST request to a backend API and, when completes, it closes the dialog using theclose
method of theMatDialogRef
service.It would be awesome if we could avoid all the boilerplate code of using the
MatDialogRef
service which also adds a bit of noise in our constructors. InjectingMatDialogRef
service asprivate dialogRef: MatDialogRef<MyComponent>
quickly makes our constructor violate themax-line-length
rule.The text was updated successfully, but these errors were encountered: