从代码手动触发ngx-sweetalert2

时间:2019-07-10 16:37:10

标签: angular sweetalert2

下面的代码可以在单击按钮时触发模式

<button type="button" class="btn btn-danger ml-3 trans-3"
        [swal]="swalDeleteConfig"
        (confirm)="deleteItem($event)">
    Delete
</button>

传递适当的选项对象

private swalDeleteConfig: SweetAlertOptions = {
    title: 'Are you sure you want to delete?',
    confirmButtonText: "Delete",
    confirmButtonClass: 'btn btn-danger',

    showCancelButton: true,
    cancelButtonText: "Cancel",
    cancelButtonClass: 'btn',

    type: "question",

    customClass: {
        actions: "mt-5 mb-5"
    }
}

此操作无需为模式指定HTML。如何手动响应此事件触发此事件?例如,异步操作完成后的烤面包。

0 个答案:

没有答案