Lifecycle events and Nav Guards

Lifecycle events have been there in Ionic 1, and Native platforms also have a well structured lifecycle, which allows us to perform actions during various stages of navigation. There are six Page events and two Nav Guards available:

  • ionViewDidLoad: When the page has loaded
  • ionViewWillEnter: When the page is about to enter
  • ionViewDidEnter: When the page is fully entered
  • ionViewWillLeave: When the page is about to leave
  • ionViewDidLeave: When the page has finished leaving
  • ionViewWillUnload: When the page is about to be destroyed
  • ionViewCanEnter: Runs before the view can enter
  • ionViewCanLeave: Runs before the view can exit

ionViewCanEnter and ionViewCanLeaeve are two Nav Guards that help control views leaving ...

Get Hybrid Mobile Development with Ionic now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.