Skip to content
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

Ionic tabs break after page reload #14344

Closed
ildar-icoosoft opened this issue Apr 17, 2018 · 3 comments
Closed

Ionic tabs break after page reload #14344

ildar-icoosoft opened this issue Apr 17, 2018 · 3 comments
Labels

Comments

@ildar-icoosoft
Copy link

ildar-icoosoft commented Apr 17, 2018

Ionic version: (check one with "x")
(For Ionic 1.x issues, please use https://github.com/ionic-team/ionic-v1)
[ ] 2.x
[ *] 3.x
[ ] 4.x

I'm submitting a ... (check one with "x")
[ *] bug report
[ ] feature request

Current behavior:
I have an application with tabs page.

Tabs page:

@Component({
  selector: 'page-tabs',
  template: `
    <ion-tabs>
      <ion-tab root="HomePage" tabTitle="Home" tabUrlPath="home-tab" tabIcon=""></ion-tab>
      <ion-tab root="NewsPage" tabTitle="News" tabUrlPath="news-tab" tabIcon=""></ion-tab>
    </ion-tabs>
 `
})
export class TabsPage {
}

HomePage:

@IonicPage()
@Component({
  selector: 'page-home',
  template: `
  	some content
  `
})
export class HomePage {
}

NewsPage:

@IonicPage()
@Component({
  selector: 'page-news',
  template: `
  	some content
  `
})
export class NewsPage {
}

When a tab is opened then URL is changed to: http://localhost/#/home-tab/home
After page reload then URL is changed to: http://localhost/#/home and there is no tabs

Expected behavior:
URL must not be changed after page reload

@ionitron-bot ionitron-bot bot added the triage label Apr 17, 2018
@HardikDG
Copy link

@ildar-icoosoft I am also having the same issue. Please let me know if you find any solution for it

@ildar-icoosoft
Copy link
Author

@HardikDG I had this error because in my TabsPage class HomePage and NewsPage were imported classes:

import {HomePage} from '.....';
import {NewsPage} from '.....';

@Component({
  selector: 'page-tabs',
  template: `
    <ion-tabs>
      <ion-tab root="HomePage" tabTitle="Home" tabUrlPath="home-tab" tabIcon=""></ion-tab>
      <ion-tab root="NewsPage" tabTitle="News" tabUrlPath="news-tab" tabIcon=""></ion-tab>
    </ion-tabs>
 `
})
export class TabsPage {
    HomePage = HomePage;
    NewsPage = NewsPage;
}

Instead, the links must be strings:

export class TabsPage {
    HomePage = 'HomePage';
    NewsPage = 'NewsPage';
}

@ionitron-bot
Copy link

ionitron-bot bot commented Sep 1, 2018

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Sep 1, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants