From the course: Angular Performance Optimization Techniques

Unlock this course with a free trial

Join today to access over 24,500 courses taught by industry experts.

Lazy-loading with standalone components

Lazy-loading with standalone components - Angular Tutorial

From the course: Angular Performance Optimization Techniques

Lazy-loading with standalone components

- [Instructor] So now that we know how to do lazy loading with angular modules, let's take a look how we can do the same thing with standalone components. So my application is fairly simple and I don't have a lot of components, but still it might make sense to use lazy loading for the cart feature or the checkout feature because those are pages that not all users are going to need. So if I want to enable lazy loading of such components, we need two things. First, these have to be standalone components. So let's check cart view and it has standalone true, so that's a standalone component. I can use lazy loading for the component. So I'm going to remove the syntax here and I'm going to make it load Component. So load Component is how we do lazy loading for a given component. And then the syntax is similar to what we've seen before. So we have to give the path to that component, which in my case is going to be cart-view/cart-view component. But then we get our component and we extract…

Contents