Lazy Loading: How to listen for URL (deep link path) changes?


#1

I’m setting up lazy loading in Ionic 3 and want to listen to URL path changes (the hash associated with components).

Seems like there should be an easy way to do this but I can’t figure it out.

The “onhashchange” event is apparently not fired, and I had trouble and gave up on trying to import the @angular/router to subscribe to the router.events (some kind of conflict with Ionic’s implementation?). Even tried some fancy code to listen to history.pushState but that didn’t fire either.

Any help would be greatly appreciated!


#2

NavController has a bunch of EventEmitters that fire when views do various things. Can you achieve your goal with them?