Lazy Loaded Tabs - Segment/URL


#1

I’m moving things over to being lazy-loaded in my app. I have my tabs working (mostly). I’m noticing that the end result has odd URL’s, which don’t work well with the back button.

I’m following this example as a baseline. I do not have any segment identifier on my tabs.ts definition of IonicPage(). I’m seeing the result as:
http://localhost:8100/#/tabs/home/home

When my home page has only home defined in it’s IonicPage as the segment. Is this the expected URL format for lazy-loaded tabs?


#2

I don’t understand your question yet. Segments and tabs are not the same thing. What do you mean by that?


#3

Sorry for the loaded term. By segment I was referring to this documentation. A segment property can be provided to override the URL path used for a page (which I am not doing).


#4

One other thing I’m noticing with the lazy-loaded tabs is the back button doesn’t work well. Navigating to 3 sample pages (Home, Accounts, Notifications) does go through the 3 (oddly named) URLs below:

Unfortunately, clicking the Back button in the browser goes right back to http://localhost:8100/#/ (doesn’t remember the stack). I’ve tried adjusting the way I load the tab pages (push vs. setRoot, vs. selecting a tab) but the results are the same.


#5

As I understand it, that’s an unavoidable side-effect of using the hash location strategy. The browser doesn’t see anything beyond the # as affecting its notion of “the current URL”. Maybe you could try switching to the path location strategy.


#6

After implementing the lazy loading (IonicPage) baseline, the back button is keeping track of previously viewed pages for me when running in a browser. It only acts extremely odd when dealing with tabs.


#7

Having the same issue as OP in regards to using Ionic 3 Lazy Loaded page modules.

@brassier did you ever happen to find a fix or read more into path location strategies for this setup?

Thanks


#8

@kevinxsalerno - Sorry I can’t help much here. I was fortunate enough to have tabs taken out of the requirements for my app. The back button with lazy loaded pages seems to work fairly well without tabs.