Angular Material: How to close all mat-dialogs and sweet-alerts on logout

This is what i have done to close any open mat-dialog throughout the application: import {MatDialog} from ‘@angular/material’; export class myClass { constructor(private dialogRef: MatDialog) { } logOut() { this.dialogRef.closeAll(); } } If you would like to close only a specific dialog you can loop through dialogRef.openDialogs and close the respective dialog using close() This … Read more

Remove “OK” button from sweet alert dialog

You can use these properties: showCancelButton: false, // There won’t be any cancel button showConfirmButton: false // There won’t be any confirm button Like This swal({ title: ‘Auto close alert!’, text: ‘I will close in 2 seconds.’, timer: 2000, showCancelButton: false, showConfirmButton: false }).then( function () {}, // handling the promise rejection function (dismiss) { … Read more