Confirmation

FuseConfirmationService is a singleton service for creating confirmation and information dialogs. Internally it uses MatDialog to create and show the dialog.

Module

Confirmation Config

Here is the interface for the Confirmation configuration:

Name Description
title
Title of the confirmation dialog.
message
Message of the confirmation dialog.
icon.show
Whether to show the icon.
icon.name
Name of the icon.
icon.color
Color of the icon.
actions.confirm.show
Whether to show the confirmation button.
actions.confirm.label
Label of the confirmation button.
actions.confirm.color
Color of the confirmation button.
actions.cancel.show
Whether to show the cancel button.
actions.confirm.label
Label of the cancel button.
dismissible
Sets the dismissible status of the confirmation dialog.
If false, confirmation dialog cannot be closed by clicking on backdrop or pressing Escape key. The close button on the top right corner also won't show up.

Methods

open(config: FuseConfirmationConfig): MatDialogRef<FuseConfirmationDialogComponent>
Opens the confirmation dialog with the given configuration

MatDialogRef

Since FuseConfirmationService uses MatDialog behind the scenes, it returns a reference to the created dialog. Using that reference, you can access to the user input:

Result Description
'confirmed'
This is the result if the user pressed the Confirm button.
'cancelled'
This is the result if the user pressed the Cancel button.
undefined
This is the result if the confirmation dismissed either using the close button, clicking on the backdrop or pressing the Escape key.

Example

Below you can configure the dialog and preview it. You can use the generated configuration object within your code to have the exact same dialog.

Configure the dialog and preview it
Title Message
Show Icon
Icon name Icon color {{color | titlecase}}
Show Confirm button
Confirm button label Confirm button color {{color | titlecase}}
Show Cancel button
Cancel button label
Dismissible