DEV Community

Discussion on: How To implement Lazy Loading in Angular

Collapse
 
vivekshingala profile image
Vivek Shingala

Hello Sai

Thanks for this tutorial. I have a question for a line in above snippet. What does the below line do?

loadChildren: "../app/posts/posts.module#PostsModule"

Collapse
 
sait profile image
Sai gowtham

We are referring to the posts.module.ts file just check out line 11 on posts.module.ts

Collapse
 
venkatagandi profile image
venkata gandi

A new addition in Angular6, we will be referring directly to the module like
loadChildren:() => PostsModule();

Thread Thread
 
kanup profile image
kanup

You won't getting lazy loading if you do it this way (as you will be adding the reference).

Thread Thread
 
rutpshah profile image
Rut Shah

You can do this way. Just remove pair of braces.
loadChildren:() => PostsModule