Skip to content
This repository was archived by the owner on May 4, 2022. It is now read-only.

Commit b0426a3

Browse files
FrancoisCamusliamdebeasi
authored andcommitted
fix(navigation): fixed nodes leak when opening and closing modals
ionic-team/ionic-framework#12574 (comment)
1 parent ee3d5f5 commit b0426a3

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/navigation/view-controller.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ export class ViewController {
4747
_state: number = STATE_NEW;
4848
_cssClass: string;
4949
_ts: number;
50+
_bindHandler: any;
5051

5152
/**
5253
* Observable to be subscribed to when the current component will become active
@@ -113,7 +114,8 @@ export class ViewController {
113114

114115
this._cssClass = rootCssClass;
115116
this._ts = Date.now();
116-
window.addEventListener('orientationchange', this.handleOrientationChange.bind(this));
117+
this._bindHandler = this.handleOrientationChange.bind(this);
118+
window.addEventListener('orientationchange', this._bindHandler);
117119
}
118120

119121
handleOrientationChange() {
@@ -542,7 +544,7 @@ export class ViewController {
542544
renderer.setElementAttribute(cmpEle, 'style', null);
543545
}
544546

545-
window.removeEventListener('orientationchange', this.handleOrientationChange.bind(this));
547+
window.removeEventListener('orientationchange', this._bindHandler);
546548
// completely destroy this component. boom.
547549
this._cmp.destroy();
548550
}

0 commit comments

Comments
 (0)