ionic-framework: Setting a tabs page as root does not load the first root page
Ionic version: (check one with “x”) [x] 3.x
I’m submitting a … (check one with “x”) [x] bug report
Current behavior: Opening a tabs page by setting it as the root page does not open the first tabs page. It only replaces the tabs bar.
Expected behavior: Opening a tabs page by setting it as the root page will open the selected tabs page and also load its first tab page.
In other words: When clicking on a main menu button, I expect not only the tabs bar to change but also to load the first tab from that tab bar.
Steps to reproduce:
- Open a terminal.
git clone https://github.com/Eraldo/tabsIssue.git
- cd tabsIssue
ionic serve
- Press
ENTER
to install the dependencies. => Wait until install finishes and your browser openshttp://localhost:8100/
- Click on “Toggle Menu” button.
- Click on “Tabs2” button.
=> url is now:
http://localhost:8100/#/tabs2/first2/first2
- Click on “Menu” button (three lines top left corner).
- Click on “Tabs” button.
=> url is now:
http://localhost:8100/#/tabs/first/first2
The page from the previous tabs page (First2Page
) is still open! I expectedFirstPage
to be open. In other words I would have expectedhttp://localhost:8100/#/tabs/first/first
Related code: https://github.com/Eraldo/tabsIssue
Other information:
I have also created a video demoing the issue in another project:
Ionic info: (run ionic info
from a terminal/cmd prompt and paste output below):
cli packages: (/Users/eraldo/inbox/temp/tabsIssue/node_modules)
@ionic/cli-plugin-ionic-angular : 1.4.1
@ionic/cli-utils : 1.7.0
ionic (Ionic CLI) : 3.7.0
local packages:
@ionic/app-scripts : 2.1.3
Ionic Framework : ionic-angular 3.6.0
System:
Android SDK Tools : 26.0.2
Node : v8.2.1
OS : macOS Sierra
Xcode : Xcode 8.0 Build version 8A218a
npm : 5.3.0
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 2
- Comments: 47 (12 by maintainers)
Commits related to this issue
- Pinned ionic-angular version due to tabs issue. https://github.com/ionic-team/ionic/issues/12625 — committed to Eraldo/coapp2 by Eraldo 7 years ago
Good night, a solution I found to insert the code in TabsPage:
Full version in my case
@kensodemann You can find the example repository here (it is based on the ionic2-starter-tabs upgraded to the ionic-angular and ionic-app-scripts nightly version).
npm install
,ionic serve
and then watch. The tabs are switched every 7.5 seconds.While putting the repo together I noticed that the underlying problem is the naming of the ts-class (and module) of the Tabs component. Naming it
tabs.ts
works just fine but re-naming it to e.g.TabsContainer.ts
creates the problem. I guess this is because the name is used for generating the DeepLink config/the URL.With
tabs.ts
after switching the tabs for the first time the the URL is:http://localhost:8100/#/tabs/contact/contact
which is correct.With
TabsContainer.ts
after switching the tabs for the first time the URL is:http://localhost:8100/#/TabsContainer/contact/about
which is incorrect.I can confirm that the workaround provided by @kensodemann works for me. I tried switching between different versions of
ionic-angular
mentioned here and at other places without any result. The only thing that fixed the problem for now is@IonicPage({ priority: 'high', segment: 'tabs' })
In my case it seems to work as expected but it’s too early to say for sure. Thanks.
3.7 nightly builds works for me too. Any Info on when this will be included in a regular release?
Thanks for opening an issue with us, we will look into this.
Using 3.9.2 and still don’t works. Using priority going against lazy loading?, I’m confused.
+1
Is there any info yet on when this will be included in a regular release?
I can confirm that it works with the 3.7 nightly build. I am using 3.8 as well and there it does not work as you mentioned. Thank you @ajonp for pointing that out.
@danbucholtz 3.7.1-201710201922 makes this work…3.8.0 will not work.
You can work around this via the following code in
TabsContainer.ts
:This bug is sufficiently different from the originally reported issue to justify its own issue if you would like to open one.
@DavidStrausz - actually, not really re-checking this issue so much as trying to see if some other issue is a duplicate of this that could be fixed via the not-yet-released nightly. I’ll have a quick look when I get a chance, though.
@HiranHabiff Thanks for your workaround, it solved my issue.
Update: No this does not work, returning back to nightly. @danbucholtz any chance someone can work through this with me?
I want to upgrade to 3.9.2, but it still breaks tabs, I am sitting at 3.7.1-201710201922 currently.
I am using @gatsinski / @kensodemann solution with
I can confirm this works so far in my testing.
@Eraldo I tried this and it seems to work https://github.com/ionic-team/ionic/issues/12697#issuecomment-332970073
Hello,
This issue is fixed. Can you try it out and let me know if the issue still exists?
Thanks, Dan