Dialog, Snackbar and Bottom Sheet: Passing Data with MatDialog, afterClosed, CDK Dialog and the Native dialog
Give MatDialog only ids, take the decision from afterClosed() and use closeOnNavigation: 'url-change': the default only closes on back/forward, so the dialog stayed open on a navigation from code. We build an order cancel dialog, an Undo snackbar and a bulk action bottom sheet in Bookstore, and measure a bare mat-dialog-close returning '', lost focus after confirming, a snackbar adding 34 kB to the initial bundle, and how MatDialog, CDK Dialog and the native dialog differ.
15 Nov 2026
·
13 min
·
8