Home > Mobile >  Angular - MatDialog, Is need to unsubscribe to keyboard events?
Angular - MatDialog, Is need to unsubscribe to keyboard events?

Time:12-20

When I subscribe to angular mat-dialog, to I need to unsubscribe it after close the dialog or in other any place? Or when the dialog is destroyed - the GC collect also its keyboard events subsribers?

    dialogRef.keydownEvents().subscribe(event => {
        // do something...
    });

CodePudding user response:

No you needn't. This events are smart in Material and do unsubscribe for you.

  • Related