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
  • 5,290
  • 3
  • 20
  • 40
Zain Khan
  • 1,644
  • 5
  • 31
  • 67

1 Answers1

1

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

Ashish S
  • 638
  • 6
  • 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