In angular2 what is the equivalent of these angular1 events?
$routeChangeStart , $routeChangeSuccess ,$routeChangeError
I want to use these events in root app component to deal with any route changing.
thanks in advance
update
If i use OnActivate, OnDeactivate events, it needs to add it to every component :(
Also i tried to implement my own RouterOutlet but i can't access previous instruction on activate, deactivate events, also i don't know how to handle the route Change Error
Also router.subscribe gave me the name only but i want to get the current and next instruction objects to change some properties
My target is:
1- Show loading indicator when start change page and hide it on page load.
2- Make transition animation rtl or ltr for current and next instruction
There are some events such as OnActivate
, OnDeactivate
and guard functions CanActivate
and CanDeactivate
that you can look at.
See the documentation for Router
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With