ConfirmDialog

The ConfirmDialog is a component used to display confirmation windows with multiple actions at the same time. In this case, it will be backed by the confirmation service utilizing obseravables. The service which uses a confirmed method for multiple actions needs to be imported.

A basic example of the ConfirmDialog component with a source button (or dialog generator button) would be written as follows:

<p-confirmDialog></p-confirmDialog>
<button type="button" (click)="confirmAccept()" pButton
icon=
"fa-check" label="Confirm"></button>
<button type="button" (click)="confirmDelete()" pButton
icon=
"fa-trash" label="Delete"></button>

In the preceding example, the confirm method will confirm an instance for customizing the Dialog UI along with accept and reject buttons. For example, the accept function invokes the confirm method of a confirmation service, which decides what action needs to be performed:

confirmAccept() {
this.confirmationService.confirm({
message: 'Do you want to subscribe for Angular news feeds?',
header: 'Subscribe',
icon: 'fa fa-question-circle',
accept: () => {
this.msgs = [];
this.msgs.push({severity:'info', summary:'Confirmed',
detail: 'You have accepted'});
}
});
}

The Dialog appeared with the click of a button component. The following screenshot shows a snapshot result of the basic confirmed Dialog example:

The footer accept and reject buttons decide whether to subscribe for the Angular news feed system.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
52.15.129.90