0

I'm using lazy loading in Angular Router. When I click on a menu item and the component is loading, I want to show a loading indicator and hide it when the component loaded completely. How can this be done?

const routes: Routes = [
  {
    path:'',
    redirectTo:'/home',
    pathMatch: 'full'
  },
  {
    path: 'home',
    component: HomeComponent
  },
  {
    path: 'site-feedback',
    loadChildren: "src/app/views/site-feedback/site- 
     feedback.module#SiteFeedbackModule"
  }
]
Markus Dresch
  • 4,873
  • 3
  • 20
  • 37
Zain Khan
  • 1,219
  • 4
  • 20
  • 41

1 Answers1

1

You can achieve this using different concepts like 1. Interceptor 2. Resolver 3. NGRX store

Ashish S
  • 569
  • 5
  • 14
  • You can follow this link: https://stackoverflow.com/questions/37069609/show-loading-screen-when-navigating-between-routes-in-angular-2 – Ashish S Jun 14 '19 at 06:24