What is Lazy Loading?

Lazy loading helps us to download the web pages in chunks instead of downloading everything in a big bundle.

To implement the Lazy Loading in Angular we need to create a routing module and a module.ts file for the component we need to lazy load.

Project Setup

Here, we set up our project. We will be using the Angular CLI (ng) utility throughout in this article.

Run the following command to install the new project:

ng new Lazy-Loading-Mat-Tabs

Creating the components

Now, we will create our components.

ng g c header 

The ng tool has…

Shubham Kansal

I am an aspiring full-stack web developer and a tech enthusiast.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store