Lazyload angular modules being loaded on another routes

Published

I’m using angular lazyloading to lazyload my modules and here is my routes:

  {
    pathMatch: 'full',
    path: '',
    loadChildren: () => import('./pages/landing/home-page/home-page.module').then(m => m.HomePageModule)
  },
  {
    path: 'web-design',
    loadChildren: () => import('./pages/landing/web-design/web-design.module').then(m => m.WebDesignModule)
  },
  {
    path: 'content',
    loadChildren: () => import('./pages/landing/content/content.module').then(m => m.ContentModule)
  },
  {
    path: 'profile',
    loadChildren: () => import('./pages/public/freelancer-profile/freelancer-profile.module').then(m => m.FreelancerProfileModule)
  },
  {
    canActivate: [LoginGuardService],
    path: 'panel',
    loadChildren: () => import('./pages/private/private.module').then(m => m.PrivateModule)
  },
  {
    path: 'freelancer',
    loadChildren: () => import('./pages/freelancer-search/freelancer-search.module').then(m => m.FreelancerSearchModule)
  },
  {
    path: '',
    loadChildren: () => import('./pages/landing/landing.module').then(m => m.LandingModule)
  },
  {
    path: '',
    loadChildren: () => import('./pages/public/public.module').then(m => m.PublicModule)
  },
  {
    path: '',
    loadChildren: () => import('./pages/public/logging/logging.module').then(m => m.LoggingModule)
  },
  {
    path: '**',
    redirectTo: '404',
  }
]; 

but when i go to /web-design page in network javascript tab content.module and freelancer-profile are being loaded as well.

enter image description here

Source: Angular Questions

Published
Categorized as angular, lazy-loading Tagged ,

Answers

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq