-
-
Notifications
You must be signed in to change notification settings - Fork 241
When using nested router-outlet, the back button exits the App #477
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Minor update: If I add an listener for backButtonPressed on android and call routerext.back() myself iit works as expected. But should this kind of workaround really be needed? |
You pretty much answered yourself. In Android the back button is bound to the page navigation, which i s controlled by the . So when you tap back - you should go to the previous page (skipping all intermediate The solution you found is a valid one, although |
Closing this issue for now - please reopen if needed. |
@vakrilov what about nested page-router-outlet? I had expected that the back button will be acting on the inner page-router-outlet but instead it acting on the outer one. Is this as expected? |
Yes, the reason for that is consistency between IOS and Android. In IOS the |
I see. I thought |
The whole Navigation structure is a mess in my opinion. Its the wrong way around and i always struggle a lot if i want to combine navigation controls like i am used to with ios. In iOS and many Android Apps nowadays you have a tab view and navigate the content of each tab. otherwise tabs make no sense. On a website you would navigate inside the tab too by pressing back. in nativescript the tabview is constructed to be inside the "UINavigationController". A back button should not change anything on the tabview but navigate its content backwards. To have an page-router-outlet that cant be wrapped into someting is a brake of that structure. Usually i want a tabview outside, sometimes also a side-drawer. and definitively i dont want it an each page but globally. |
I tried to use this function routerExtensions.back() on activityBackPressedEvent but I get error "cannot get property back". I have imported the RouterExtensions file as well. Could anyone help me out with this? Thanks. |
Hey @vipul1905: Can you please make sure you are using the |
I certainly did. I used the template project where this was set already. |
I'm trying to add child-routes to my
Angular Native
App, but when I click my android back-button the App just exits.I've tried to write an example to show what the problem it here: https://github.com/m-abs/angular2-seed-advanced/tree/child-router
It's based on Nathan Walker's angular2-seed-advanced as that's what we use in our project.
What I've done:
router-outlet
here: https://github.com/m-abs/angular2-seed-advanced/blob/child-router/src/client/app/components/home/home.component.tns.html#L23What happens:
ActionBar
works per ChildComponent, which were a bit of a surprise.What I'd expect:
More data:
I've tried tracing it to try and make heads or tail on it:
As you can see NSLocationStrategy.pushState(
/home/child2
) is called for the child-route, but afteronBackPressed
the App just exits.The text was updated successfully, but these errors were encountered: