I have an application with 5 tabs [Home, Search, Map, Info, Tarif].
I can navigate to the Map page directly from tab menu without parameter but also from Home page i want to access Map page with parameter.
I don’t know how to define the route into the tabs.router.module.ts
This is my tabs.router.module.ts
const routes: Routes = [
{
path: 'tabs',
component: TabsPage,
children: [
{
path: 'home',
outlet: 'home',
component: HomePage
},
{
path: 'search',
outlet: 'search',
component: SearchPage
},
{
path: 'map',
outlet: 'map',
component: MapPage
},
{
path: 'info',
outlet: 'info',
component: InfoPage
},
{
path: 'tarif',
outlet: 'tarif',
component: TarifPage
}
]
},
{
path: '',
redirectTo: '/tabs/(home:home)',
pathMatch: 'full'
},
{
path: 'search',
redirectTo: '/tabs/(search:search)',
pathMatch: 'full'
},
{
path: 'map',
redirectTo: '/tabs/(map:map)',
pathMatch: 'full'
}
];
and my app.routing.module.ts
const routes: Routes = [
{ path: '', loadChildren: './tabs/tabs.module#TabsPageModule', canActivate: [AuthGuard] },
{ path: 'tabs', loadChildren: './tabs/tabs.module#TabsPageModule', canActivate: [AuthGuard] },
{ path: 'map', loadChildren: './pages/map/map.module#MapPageModule', canActivate: [AuthGuard] },
{ path: 'search', loadChildren: './pages/search/search.module#SearchPageModule', canActivate: [AuthGuard] },
{ path: 'station', loadChildren: './pages/station/station.module#StationPageModule', canActivate: [AuthGuard] },
{ path: 'info', loadChildren: './pages/info/info.module#InfoPageModule', canActivate: [AuthGuard] },
{ path: 'tarif', loadChildren: './pages/tarif/tarif.module#TarifPageModule', canActivate: [AuthGuard] }
];
to access Map page from Home page i use this:
goMap(){
this.router.navigate(['map'], {queryParams: this.station});
}
Thx for helping