I want to execute some code every time the page changes.
I could add add an ngOnDestroy method to every page. It appears that I could use Ionic 2 page lifec
ngOnDestroy
In Ionic2+ you can simply subscribe to the event you want to execute your code on as follows:
this.navCtrl.ionViewWillUnload.subscribe(view => { console.log(view); });
You can subscribe to all the Lifecycle Events