Event on loaded page content (Ionic 2)?

I am using NavController http://ionicframework.com/docs/v2/api/components/nav/NavController/ and I am changing the page and I need to know when a new page is loading, are there any events?

+3
javascript angular ionic-framework ionic2
source share
2 answers

Of course, you have Lifecycle events in Ionic2 that you can use.

  • ionViewDidLoad
  • ionViewWillEnter
  • ionViewDidEnter
  • ionViewWillLeave
  • ionViewDidLeave
  • ionViewWillUnload

Example: here :

ionViewDidLoad() { console.log("I'm alive!"); } ionViewWillLeave() { console.log("Looks like I'm about to leave :("); } 
+14
source share

which used angular2 can call ngAfterViewInit ():

 ngAfterViewInit() { // this.yourMethod } 
0
source share

All Articles