0

in Ionic I have an app-routing module, which looks like that:

import { NgModule } from '@angular/core';
import { PreloadAllModules, RouterModule, Routes } from '@angular/router';

const routes: Routes = [
  {
    path: '',
    redirectTo: '',
    pathMatch: 'full'
  },
  {
    path: '',
    children: [
      {
        path: '',
        loadChildren: () => import('./home/home.module').then( m => m.HomePageModule),
      }
    ]
  },
  {
    path: 'auth',
    loadChildren: () => import('./auth/auth.module').then( m => m.AuthPageModule)
  },
  {
    path: 'user-area',
    loadChildren: () => import('./user-area/user-area.module').then( m => m.UserAreaPageModule)
  },
  {
    path: 'newsletter',
    loadChildren: () => import('./newsletter/newsletter.module').then( m => m.NewsletterPageModule)
  },
  {
    path: 'settings',
    loadChildren: () => import('./settings/settings.module').then( m => m.SettingsPageModule)
  },
  {
    path: 'contact',
    loadChildren: () => import('./contact/contact.module').then( m => m.ContactPageModule)
  },
  {
    path: 'data',
    loadChildren: () => import('./data/data.module').then( m => m.DataPageModule)
  },
  {
    path: 'logout',
    loadChildren: () => import('./logout/logout.module').then( m => m.LogoutPageModule)
  },
  {
    path: 'tour-details',
    loadChildren: () => import('./tour-details/tour-details.module').then( m => m.TourDetailsPageModule)
  },
];

@NgModule({
  imports: [
    RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules })
  ],
  exports: [RouterModule]
})
export class AppRoutingModule { }

The last page tour-details uses tabs, so I created a tour-details routing module:

import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';

import { TourDetailsPage } from './tour-details.page';

const routes: Routes = [
  {
    path: '',
    component: TourDetailsPage,
    children: [
      {
        path: '',
        pathMatch: 'full',
        redirectTo: 'info',
      },
      {
        path: 'info/:url',
        loadChildren: () => import('./info/info.module').then((m) => m.InfoPageModule),
      },
      {
        path: 'map/:url',
        loadChildren: () => import('./map/map.module').then((m) => m.MapPageModule),
      },
      {
        path: 'play/:url',
        loadChildren: () => import('./play/play.module').then((m) => m.PlayPageModule),
      },
      {
        path: 'credits/:url',
        loadChildren: () => import('./credits/credits.module').then((m) => m.CreditsPageModule),
      },
    ]
  }
];

@NgModule({
  imports: [RouterModule.forChild(routes)],
  exports: [RouterModule],
})
export class TourDetailsPageRoutingModule {}

So all my tabs need an :url param, but I'm only able to send it to the first tab info, since here the information comes from a RouterLink in a button. How can I send the :url param to all the ther tabs?

0

Browse other questions tagged or ask your own question.