top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

In Angular (2/4/5),What is Lazy Loading and how to use it?

0 votes
452 views
In Angular (2/4/5),What is Lazy Loading and how to use it?
posted Dec 27, 2017 by Madhavi Latha

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

What is Lazy Loading?
Lazy loading is a design pattern commonly used in computer programming to defer initialization of an object until the point at which it is needed. It can contribute to efficiency in the program’s operation if properly and appropriately used.

In Angular, Lazy Loading used to load the modules asynchronously. For a large application, Lazy Loading is mainly used. Also, Lazy Loading used to improve the application performance. Because it will load modules whenever required.

So, In angular based on route changes, we can load the modules asynchronously.

Example:

Const Route : [
   { path: 'user', loadChildren:'./user/user.module#UserModule' } 
]

Using LoadChildren We can load the module based on route changes

answer Dec 29, 2017 by Parampreet Kaur
...