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
1st thing Router is present in @angular/router module.
@angular/router
And for listening route change event you can place subscription on router changes object.
changes
Code
class MyRouteEventClass { constructor(private router: Router) { router.changes.subscribe((val) => { /* Awesome code here */ } ) } }