I have an issue with my sidemenu. I would like to have a default route that it goes to when pressing the back button on android. Can this be done. Right now when I click the back button it will route to the page that it was routed to previous to that instead on the page that I would like to be the root page. Or, if anyone knows how to exit the application that could work as well.
here are my sidemenu routes
const routes: Routes = [
{
path: '',
loadChildren: './tabs/tabs.module#TabsPageModule'
},
{
path: 'bible',
loadChildren: './bible/bible.module#BiblePageModule'
},
{
path: 'bible-search',
loadChildren: './bible-search/bible-search.module#BibleSearchPageModule'
},
{
path: 'bible-view/:chapter',
loadChildren: './bible-view/bible-view.module#BibleViewPageModule'
},
{
path: 'map',
loadChildren: './map/map.module#MapPageModule'
},
{
path: 'give',
loadChildren: './give/give.module#GivePageModule'
}
];
As you can see my default route is a tabs page, here is my tabs page routes.
const routes: Routes = [
{
path: 'tabs',
component: TabsPage,
children: [
{
path: 'messages',
outlet: 'messages',
component: MessagesPage
},
{
path: 'message-details/:id',
outlet: 'messages',
component: MessageDetailsPage
},
{
path: 'e3',
outlet: 'e3',
component: E3Page
},
{
path: 'e3-view/:reading',
outlet: 'e3',
component: E3ViewPage
},
{
path: 'prayers',
outlet: 'prayers',
component: PrayersPage
},
{
path: 'request-prayer',
outlet: 'prayers',
component:RequestPrayerPage
}
]
},
{
path: '',
redirectTo: '/tabs/(messages:messages)',
pathMatch: 'full'
}
];
I have the following code in my sidemenu pages to capture back button clicks but I am not sure how to correctly route this. I would like to route to my Messages Page which is a child of the Tabs Page.
this.platform.backButton.subscribe(() => {
console.log('Back Pressed');
});