0
votes

guys , I am creating and ionic app which has details page with page id, I am trying to configure router, its not redirecting its always on main page , my code is below please check ?

parent page route

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

import { RecepiesPage } from './recepies.page';

const routes: Routes = [
  {
    path: '',
    component: RecepiesPage
  },
  {
    path: 'recipedatail',
    loadChildren: () => import('./recipedatail/recipedatail.module').then( m => m.RecipedatailPageModule)
  },
];

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

details page routing

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

import { RecipedatailPage } from './recipedatail.page';

const routes: Routes = [
  {
    path: '',
    component: RecipedatailPage
  },
  {
    path: ':recipeId',
    loadChildren: () => import('./recipedatail.module').then( m => m.RecipedatailPageModule)
  },
];

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

1 Answers

0
votes

Check the angular documentation for correct router implementation