-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Open
Labels
P5The team acknowledges the request but does not plan to address it, it remains open for discussionThe team acknowledges the request but does not plan to address it, it remains open for discussionarea: material/dialogfeatureThis issue represents a new feature or feature request rather than a bug or bug fixThis issue represents a new feature or feature request rather than a bug or bug fixneeds: discussionFurther discussion with the team is needed before proceedingFurther discussion with the team is needed before proceeding
Description
Feature Description
My proposal is to create one or two methods on the MatDialog
provider/controller to allow component-less alert and confirm dialogs, for example:
// Alert dialog
this.dialog.alert({
title: 'Forbidden',
message: 'The resource you are trying to access is forbidden.',
okButton: 'OK'
})
// Confirm dialog
this.dialog.confirm({
title: 'Server error',
message: 'The server is currently in maintenance.',
confirmButton: 'Retry',
cancelButton: 'Cancel'
})
Alternatively, both alert
and confirm
could be on a single method:
this.dialog.alert({
title: 'The title',
message: 'The message',
confirmButton: 'OK', // Optional, only for confirm
dismissButton: 'Dismiss'
}).afterClose().subscribe((result: boolean) => console.log); // True if confirm, false if dismiss.
Use Case
Currently, we have to create a component for every dialog, event the simplest dialog. This is painful and useless in most cases. Other alternatives (what I do) is to create a AlertService
that does it for me. But makes no sense maintain it if it could be a simple feature of MatDialog
craig-riecke, iget-master, geromegrignon, RylaiCF, smileright and 16 more
Metadata
Metadata
Assignees
Labels
P5The team acknowledges the request but does not plan to address it, it remains open for discussionThe team acknowledges the request but does not plan to address it, it remains open for discussionarea: material/dialogfeatureThis issue represents a new feature or feature request rather than a bug or bug fixThis issue represents a new feature or feature request rather than a bug or bug fixneeds: discussionFurther discussion with the team is needed before proceedingFurther discussion with the team is needed before proceeding