Will it help to reduce the loading time?(like by loading only current module to client's device? )
what I understand is that...
- It will increase the number of request between server and client?
- It will increase the complexity of your code.(Since you need to take care of
- importing and exporting modules and take special care in routing too)
Angular supports lazy loading of modules. This way you can split up your application into parts that are loaded only on demand.
See also https://angular.io/docs/ts/latest/guide/router.html#!#asynchronous-routing
update
While lazy loading doesn't reduce the load time when everything is required at the start page which is IMHO not the case in almost 100% of Angular2 applications, it reduces the time for the initial load and delays the load time to when a module is actually required. Angular also supports preload feature to load lazy loaded modules before they are required, but still doesn't load them with the initial load.
The number of requests will be higher, but the amount of data loaded with the first request will be less. The main idea is to reduce the time until the user gets the first screen rendered. If an applications consists of parts where some are heavily used and other rarely, then it's usually a good idea to not load the rarely used parts until they are actually used - which means "lazy" or "on demand" - only when actually required.
If you want to gain full benefit of lazy loading, you will need to think about your architecture. That doesn't mean the code needs to become more complex. You just need to make decisions which module you put your components, directives, services into.
I don't see much difference here, because you should split your application in different modules (for example per feature) anyway, even if they are not lazy loaded.