-
-
Notifications
You must be signed in to change notification settings - Fork 240
Description
The Scenario
We have a following app scenario:
- The app has root navigation using
<page-router-outlet>
- On one of the pages (let's name it "main") there is a nested navigation using the stock angular
<router-outlet>
. Navigating the nested router outlet is usually controlled withRadSideDrawer
.
There are sample implementations described in #343 and in this gist by @NathanWalker
The Problem
When navigating form "main" page to another page(let's name it "detail") and then back again, the content of the nested <router-outlet>
inside the main page is loaded after the page animation is finished:
There are two different issues at hand:
- The component that was previously shown inside the
<rotuer-outlet>
is re-created and not reused. - The actual instantiation of the component happens after the page animations has finished. This is triggered in the
<page-router-outlet>
implementation and happens in page.navigatedFrom event. Which means the "main" page is empty during the animation and the content is loaded after the navigations has finished.
Additional Information
The reason why page.navigatED From
event is used instead page.navigatING From
is that in IOS you can start a back navigation using swipe gesture, but cancel it in the middle:
If we trigger the angular back
navigation on the page.naivgatING
event, angular will remove
the components form the current page and instantiate the component on the page you are navigation to. However, if you then cancel the animation you will end up with a page that has been cleared and corrupted navigations stack.