0

I'm using Angular Material Dialog and I was wondering if I need destroy it after the component is closed.

Example

openUpdateStatusDialog(alertId: string): void {
  this.dialog.open(UpdateStatusDialogComponent, {
    data: alertId,
    panelClass: 'ion-dialog'
  }).afterClosed()
  .pipe(
    map((result) => {
      if (result) {
        this.updateNotificationStatus.emit(result);
      }
    }),
    untilDestroyed(this))
  .subscribe();
}
Christopher Peisert
  • 21,862
  • 3
  • 86
  • 117
Vinni
  • 191
  • 2
  • 2
  • 11

1 Answers1

0

AngularMaterial Dialog components do not need to be manually destroyed after being closed.

Take a look at the official Angular Material Dialog Examples.

See Also

Angular - DialogRef - Unsubscribe - Do I need to unsubscribe from afterClosed?

Christopher Peisert
  • 21,862
  • 3
  • 86
  • 117