Zain Khan
Zain Khan

Reputation: 1814

Loader When Click On Route Lazy Loading [ Angular ]

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"
  }
]

Upvotes: 0

Views: 585

Answers (1)

Ashish S
Ashish S

Reputation: 738

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

Upvotes: 1

Related Questions