Having trouble accessing router events

In my main app class, why doesn’t the event emit as follows?

this.$f7.router.on('routeChange', () => {
  // never gets called
})

It may seem contrived, but what I really want to do is pass the router reference along to another class that sets up its own observables directly on the router.

Also, I don’t understand the following:

> this.$f7.router.app.router === this.$f7.router
< true
> this.$f7.router.app.views.main.router === this.$f7.router
< false

Where did you see $f7.router reference in docs? Never use it. You should only use Views’ router like this.$f7router if calling inside of router loaded component, or like this.$f7.views.main.router if calling from outside.

1 Like

So it should be this.$f7.on('routeChanged', ...) to catch routeChanged on all views/routers or `this.$f7.views.main.on(‘routeChanged’, …)’ to catch it on main view router

1 Like