--- a/node_modules/ionic-angular/components/content/content.js +++ b/node_modules/ionic-angular/components/content/content.js @@ -136,29 +136,25 @@ this._imgReqBfr = config.getNumber('imgRequestBuffer', 1400); this._imgRndBfr = config.getNumber('imgRenderBuffer', 400); this._imgVelMax = config.getNumber('imgVelocityMax', 3); + this._scroll = new ScrollView(_plt, _dom); if (viewCtrl) { // content has a view controller viewCtrl._setIONContent(this); viewCtrl._setIONContentRef(elementRef); - var readSub = viewCtrl.readReady.subscribe(function () { - readSub.unsubscribe(); + this.viewCtrlReadSub = viewCtrl.readReady.subscribe(function () { + _this.viewCtrlReadSub.unsubscribe(); _this._readDimensions(); }); - var writeSub = viewCtrl.writeReady.subscribe(function () { - writeSub.unsubscribe(); + this.viewCtrlWriteSub = viewCtrl.writeReady.subscribe(function () { + _this.viewCtrlWriteSub.unsubscribe(); _this._writeDimensions(); }); } else { // content does not have a view controller - _dom.read(function () { - _this._readDimensions(); - }); - _dom.write(function () { - _this._writeDimensions(); - }); + _dom.read(this._readDimensions.bind(this)); + _dom.write(this._writeDimensions().bind(this)); } - this._scroll = new ScrollView(_plt, _dom); } Object.defineProperty(Content.prototype, "contentHeight", { /** @@ -322,6 +318,9 @@ */ Content.prototype.ngOnDestroy = function () { this._scLsn && this._scLsn(); + this._viewCtrlReadSub && this._viewCtrlReadSub.unsubscribe(); + this._viewCtrlWriteSub && this._viewCtrlWriteSub.unsubscribe(); + this._viewCtrlReadSub = this._viewCtrlWriteSub = null; this._scroll && this._scroll.destroy(); this._scrollEle = this._fixedEle = this._footerEle = this._scLsn = this._scroll = null; };