Skip to content

Commit 397ee49

Browse files
committed
fix(material/sidenav): fix view already destroyed error
1 parent 8b49a88 commit 397ee49

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/material/sidenav/drawer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ export class MatDrawer implements AfterViewInit, AfterContentChecked, OnDestroy
333333
@Optional() @Inject(DOCUMENT) private _doc: any,
334334
@Optional() @Inject(MAT_DRAWER_CONTAINER) public _container?: MatDrawerContainer,
335335
) {
336-
this.openedChange.subscribe((opened: boolean) => {
336+
this.openedChange.pipe(takeUntil(this._destroyed)).subscribe((opened: boolean) => {
337337
if (opened) {
338338
if (this._doc) {
339339
this._elementFocusedBeforeDrawerWasOpened = this._doc.activeElement as HTMLElement;

0 commit comments

Comments
 (0)