Answer the question
In order to leave comments, you need to log in
Is there a way to know that the angular route is gone?
I want to know that they switched to the route and left it.
Usually in the main component from the loadable module I find out when creating, and when destroying.
Later I began to add a resolver when they switch to the route.
But how do I know that they left the route?
Answer the question
In order to leave comments, you need to log in
The resolver should not know that the page has been left. Its task is to accept some data, and return others.
To do this, the router has Observable events - where there is, for example, NavigationEnd -> more details in the docks ( https://angular.io/api/router/RouterEvent ) - where you can subscribe and through RxJs operators not only track, but combine any case and actually react to it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question