0

In app.route configuration we have the following routes:

   {
        path: 'homedetails',
        loadChildren: '../app/home/home-details/home-details.module#HomeDetailsModule',
        data: { preload: true, paramKey: 'homekey', paramType: 'number' },
        canActivate: [ParamsGuard]
      },

In lazy loaded modules Home Details route have

const routes: Routes = [{
  path: '',
  component: HomeComponent,
  // canActivate: [AuthGuard],
  children: [
    {
      path: 'Home-properties',
       loadChildren: '../../../app/Home/Home-details/Home-property/Home-property.module#HomePropertyModule',
    },
    {
      path: 'access',
      component: AccessComponent,
      resolve: { 'info-message': InfoMessageResolver }
    },
      {
      path: '',
      redirectTo: 'access',
      pathMatch: 'full'
    }
  ],
}];

Issue is when homedetails path load the lazy loaded module it always navigate to default path 'access' as per business requirement need to load the home-properties instead of default 'access' path.

Load Children always load the default navigation instead of provided routes.

Appreciate any suggestion and solution.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
aryan
  • 105
  • 4
  • 15

2 Answers2

0

First of all, you should put your redirect as the first route. Secondly, you are redirected to access route because you specified it in your route

{
    path: '',
    redirectTo: 'access',
    pathMatch: 'full'
}

As you mentioned access is the default path, obviously it will go to that route because it's an empty children path. If you really want to go to Home-properties route then that should be your redirect path

Bon Macalindong
  • 1,310
  • 13
  • 20
0

In here you could put in Home-properties like this

{
      path: 'Home-properties',
      loadChildren: '../../../app/Home/Home-details/Home-property/Home-property.module#HomePropertyModule',
      pathMatch: 'full',
 },
Hans
  • 308
  • 7
  • 20