I use side menu on Ionic 5.
I have routing issues.
According to tutorials and references, they used side menu routing as a root routing.
But I need to use side menu as a child routing.
My source code is like follows.
app.component.html
<ion-app>
<ion-router-outlet></ion-router-outlet>
</ion-app>
app-routing.module.ts
const routes: Routes = [
{
path: '',
redirectTo: 'menu',
pathMatch: 'full'
},
{
path: 'menu',
loadChildren: () => import('./menu/menu.module').then( m => m.MenuPageModule)
},
{
path: 'login',
loadChildren: () => import('./login/login.module').then( m => m.PageModule)
}
];
menu.page.html
<ion-menu side="start" menuId="first" contentId="main">
<ion-header>
<ion-toolbar color="primary">
<ion-title>Start Menu</ion-title>
</ion-toolbar>
</ion-header>
<ion-content id="main">
<ion-list>
<ion-item>Home</ion-item>
<ion-item>About</ion-item>
</ion-list>
</ion-content>
</ion-menu>
menu-routing.module.ts
const routes: Routes = [
{
path: '',
component: MenuPage,
children: [
{
path: 'home',
loadChildren: () => import('../home/home.module').then( m => m.HomePageModule)
},
{
path: 'about',
loadChildren: () => import('../home/home.module').then( m => m.HomePageModule)
}
]
},
{
path: '',
redirectTo: '/menu/home',
pathMatch: 'full'
}
];
then run
\> ionic serve
it displays blank page…( home page doesn’t appear)
but, if I swipe on left side, menu section appears.
Please help me…