Angular module lazy load cache issue

100 Views Asked by At

I have used Angular 11 in my single page application (SPA). I have used lazy load module in app-routing.module.ts. The issue is when I redirect to that module/component, it get the results from browser cache. As Lazy-loaded modules are loaded asynchronously and cached by the Angular router, so subsequent visits to the same route will load the module from the cache instead of making a new request to the server. Is there any way we can request a module forcefully from the server?

app-routing.module.ts

 children: [
      {
        path: 'dashboard', loadChildren: () => import('./pages/dashboard/dashboard.module').then(m => m.DashboardModule),
        data: { breadcrumb: 'Dashboard' }
      }
]

Any help or suggestions would be highly appreciated.

Thanks

0

There are 0 best solutions below