mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-22 05:21:52 +08:00
@ -802,6 +802,7 @@ export class NavController extends Ion {
|
|||||||
// set that it is the init leaving view
|
// set that it is the init leaving view
|
||||||
// the first view to be removed, it should init leave
|
// the first view to be removed, it should init leave
|
||||||
view.state = STATE_INIT_LEAVE;
|
view.state = STATE_INIT_LEAVE;
|
||||||
|
view.willUnload();
|
||||||
|
|
||||||
// from the index of the leaving view, go backwards and
|
// from the index of the leaving view, go backwards and
|
||||||
// find the first view that is inactive so it can be the entering
|
// find the first view that is inactive so it can be the entering
|
||||||
@ -836,7 +837,6 @@ export class NavController extends Ion {
|
|||||||
this._views.filter(v => v.state === STATE_REMOVE).forEach(view => {
|
this._views.filter(v => v.state === STATE_REMOVE).forEach(view => {
|
||||||
view.willLeave();
|
view.willLeave();
|
||||||
view.didLeave();
|
view.didLeave();
|
||||||
view.didUnload();
|
|
||||||
this._views.splice(this.indexOf(view), 1);
|
this._views.splice(this.indexOf(view), 1);
|
||||||
view.destroy();
|
view.destroy();
|
||||||
});
|
});
|
||||||
|
@ -271,7 +271,9 @@ class AnotherPage {
|
|||||||
constructor(
|
constructor(
|
||||||
private nav: NavController,
|
private nav: NavController,
|
||||||
private viewCtrl: ViewController
|
private viewCtrl: ViewController
|
||||||
) {}
|
) {
|
||||||
|
console.log('Page, AnotherPage, constructor', this.viewCtrl.id);
|
||||||
|
}
|
||||||
|
|
||||||
pushFullPage() {
|
pushFullPage() {
|
||||||
this.nav.push(FullPage);
|
this.nav.push(FullPage);
|
||||||
@ -304,6 +306,34 @@ class AnotherPage {
|
|||||||
this.viewCtrl.setBackButtonText(backButtonText);
|
this.viewCtrl.setBackButtonText(backButtonText);
|
||||||
++this.bbCount;
|
++this.bbCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onPageWillEnter() {
|
||||||
|
console.log('Page, AnotherPage, onPageWillEnter', this.viewCtrl.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
onPageDidEnter() {
|
||||||
|
console.log('Page, AnotherPage, onPageDidEnter', this.viewCtrl.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
onPageWillLeave() {
|
||||||
|
console.log('Page, AnotherPage, onPageWillLeave', this.viewCtrl.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
onPageDidLeave() {
|
||||||
|
console.log('Page, AnotherPage, onPageDidLeave', this.viewCtrl.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
onPageWillUnload() {
|
||||||
|
console.log('Page, AnotherPage, onPageWillUnload', this.viewCtrl.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
onPageDidUnload() {
|
||||||
|
console.log('Page, AnotherPage, onPageDidUnload', this.viewCtrl.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnDestroy() {
|
||||||
|
console.log('Page, AnotherPage, ngOnDestroy', this.viewCtrl.id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -183,23 +183,6 @@ export class ViewController {
|
|||||||
return (this.index === 0);
|
return (this.index === 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
addDestroy(destroyFn: Function) {
|
|
||||||
this._destroys.push(destroyFn);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
destroy() {
|
|
||||||
for (var i = 0; i < this._destroys.length; i++) {
|
|
||||||
this._destroys[i]();
|
|
||||||
}
|
|
||||||
this._destroys = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
@ -489,10 +472,21 @@ export class ViewController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* The view has been destroyed and its elements have been removed.
|
|
||||||
*/
|
*/
|
||||||
didUnload() {
|
addDestroy(destroyFn: Function) {
|
||||||
|
this._destroys.push(destroyFn);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
destroy() {
|
||||||
ctrlFn(this, 'onPageDidUnload');
|
ctrlFn(this, 'onPageDidUnload');
|
||||||
|
|
||||||
|
for (var i = 0; i < this._destroys.length; i++) {
|
||||||
|
this._destroys[i]();
|
||||||
|
}
|
||||||
|
this._destroys = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user