diff --git a/ionic/components/nav/nav-item.js b/ionic/components/nav/nav-item.js index 8bcefe0d94..cf71232b06 100644 --- a/ionic/components/nav/nav-item.js +++ b/ionic/components/nav/nav-item.js @@ -3,6 +3,7 @@ import {bind} from 'angular2/di'; import * as util from 'ionic/util'; import {NavController} from './nav-controller'; +import {Lifecycle} from 'ionic/components/view/lifecycle'; export class NavItem { @@ -48,7 +49,10 @@ export class NavItem { ]); this.nav.loader.loadNextToExistingLocation(this.Component, this.nav.contentElementRef, injector).then((componentRef) => { - console.log('nav-item loadNextToExistingLocation', this.nav.contentElementRef) + + Lifecycle.viewLoaded(componentRef.instance); + + console.log('nav-item loadNextToExistingLocation', this.nav.contentElementRef); let navbarContainer = this.nav.navbarContainerRef; if (componentRef && componentRef.dispose && navbarContainer) { diff --git a/ionic/components/nav/test/basic/pages/first-page.js b/ionic/components/nav/test/basic/pages/first-page.js index e4da5db14b..68b2c7581d 100644 --- a/ionic/components/nav/test/basic/pages/first-page.js +++ b/ionic/components/nav/test/basic/pages/first-page.js @@ -34,6 +34,14 @@ export class FirstPage { this.val = Math.round(Math.random() * 8999) + 1000; } + viewLoaded() { + console.log('VIEW LOADED'); + } + + viewWillShow() { + console.log('VIEW WILL SHOW'); + } + push() { this.nav.push(SecondPage, { id: 8675309, myData: [1,2,3,4] }, { animation: 'ios' }); } diff --git a/ionic/components/view/lifecycle.js b/ionic/components/view/lifecycle.js new file mode 100644 index 0000000000..990f599e0f --- /dev/null +++ b/ionic/components/view/lifecycle.js @@ -0,0 +1,8 @@ +export class Lifecycle { + static viewLoaded(component) { + component.viewLoaded && component.viewLoaded(); + } + static viewWillShow(component) { + component.viewWillShow && component.viewWillShow(); + } +}