I have a medium size Angular App. Which is taking quite a lot of time in loading. Thus I decided to use Lazy Loading. I have a FeedbackModule which is lazy loaded. It looks like this:
Feedback Route:
export const FEEDBACK_ROUTES: Routes = [
{ path : '' , component : FeedbackComponent},
{ path : 'prebilling' , component : PrebillingComponent},
{ path : 'postbilling/login' , component : PostbillingComponentLogin},
{ path : 'postbilling/rating/:mid/:return/:mtid' , component : PostbillingRatingComponent},
{ path : 'prebilling/rating/:mid/:type/:mtid/:mcnt/:mebid' , component : PrebillingRatingComponent},
{ path : 'prebilling/rating' , component : PrebillingRatingComponent},
{ path : 'postbilling/rating/:id' , component : PostbillingRatingComponent},
{ path : 'prebilling/rating/:mid/:type/:mtid' , component : PrebillingRatingComponent},
{ path : 'thanks/:id' , component : ThankYouComponent}
];
Feedback Module:
@NgModule({
declarations: [
PostbillingComponentLogin,
PrebillingComponent,
PrebillingRatingComponent,
PostbillingRatingComponent,
ThankYouComponent,
FeedbackComponent,
PostbillingForgotPassComponentLogin
],
imports: [
CommonModule,
CommonCustomModule,
FormsModule,
RouterModule.forChild(FEEDBACK_ROUTES)
],
exports:[ RouterModule]
})
export class FeedbackModule {
}
App.route.ts:
export const ROUTES : Routes = [
...COMMON_ROUTES,
{ path:'feedback', loadChildren: './feedBack/feedback.module#FeedbackModule'}
]
Now when I got for path /feedback Feedback component is loaded. But when I for /feedback/prebilling or any other path it still loads FeedbackComponent. Thanks in advance !
