1
votes

I have been playing with the Angular2 Router, to figure out some other issues.

I've came across something like that in Angular2 documentation:

deactivate(instruction: Instruction) : Promise
Removes the contents of this router's outlet and all descendant outlets

I am wondering how can I set delay, and use new class as a provider, so that all of the Router navigation has some delay (lets say 1s). I want to do it, so that I can have slide in slide out animation - If I would be able to delay Route deactivation, I can have both Routes (previous and next) visible at one time.

1

1 Answers

2
votes

You can implement CanDeactivate but this is required on each component that is added/remove by the router. If you return a Promise that settles after 1s then the removal of the component is delayed this 1s.

I don't know if there is a more generic way like using a custom implementation (subclass) of the <router-outlet> or similar.