Lot of students where asking for a working code of Angular 2 lazy loading. So below is the video for the same.
The magic of lazy loading in angular 2 happens in routing. In routing you need to use “loadChildren” with the path to the module in a string.
export const ApplicationRoutes = [ { path: 'Welcome', component: WelcomeComponent }, { path: 'UI/Master.html', component: WelcomeComponent }, { path: 'Customer', loadChildren: 'Binder/CustomerModule#CustomerModule'}, { path: 'SupplierMain', loadChildren: 'Binder/SupplierModule#SupplierModule'} ];
Below is a simple video which demonstrates how lazy loading looks like.
https://www.facebook.com/shivprasad.koirala/videos/1178327278918093/
Do not miss our Angular 2 training happening this coming Saturday and Sunday in Mumbai
http://stepbystepschools.net/?page_id=622