mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-21 04:53:58 +08:00
@ -802,6 +802,7 @@ export class NavController extends Ion {
|
||||
// set that it is the init leaving view
|
||||
// the first view to be removed, it should init leave
|
||||
view.state = STATE_INIT_LEAVE;
|
||||
view.willUnload();
|
||||
|
||||
// from the index of the leaving view, go backwards and
|
||||
// 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 => {
|
||||
view.willLeave();
|
||||
view.didLeave();
|
||||
view.didUnload();
|
||||
this._views.splice(this.indexOf(view), 1);
|
||||
view.destroy();
|
||||
});
|
||||
|
@ -271,7 +271,9 @@ class AnotherPage {
|
||||
constructor(
|
||||
private nav: NavController,
|
||||
private viewCtrl: ViewController
|
||||
) {}
|
||||
) {
|
||||
console.log('Page, AnotherPage, constructor', this.viewCtrl.id);
|
||||
}
|
||||
|
||||
pushFullPage() {
|
||||
this.nav.push(FullPage);
|
||||
@ -304,6 +306,34 @@ class AnotherPage {
|
||||
this.viewCtrl.setBackButtonText(backButtonText);
|
||||
++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);
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
@ -489,10 +472,21 @@ export class ViewController {
|
||||
|
||||
/**
|
||||
* @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');
|
||||
|
||||
for (var i = 0; i < this._destroys.length; i++) {
|
||||
this._destroys[i]();
|
||||
}
|
||||
this._destroys = [];
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user