Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 48979

Ion-back-button with with non-consuming routes

$
0
0

Hi,

I would appreciate a comment on my situation below regarding how the back-button consumes route segments.

I am fully aware of the problems of the back button not showing if there is nothing to go back to or if there is no defaultHref. This is not my problem.

It seems that when the route has non-segment-consuming components the back button will navigate backwards one step too far.

Example:
-In my routing table have a Home-section that is wrapped with a shell component before lazy loading the actual route, say page A.

const routes = [{ path: 'home', component: ShellComponent, children: [...] }]

-From the root, I navigate to another page in another page, say B.
-Then I navigate further to page C by clicking something on page B. Page B and C are outside the Home section.
-When at page C I click on the back-button I will be returned to page A - not page B.

By experimenting, I have found out that if I remove the shell component, the navigation behaves as expected.

Is behavior with the shell by design or am I doing something wrong? How can I avoid this and make the behavior “normal”?

The shell component is essential to me, as it is here I decide whether to show a mobile or a desktop layout. Removing it would require a re-thinking of the architecture/navigation strategy of the whole app.

Any thoughts?

Thanks,
Oskar

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 48979

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>