Juri Strumpflohner
Juri Strumpflohner Juri is a full stack developer and tech lead with a special passion for the web and frontend development. He creates online videos for Egghead.io, writes articles on his blog and for tech magazines, speaks at conferences and holds training workshops. Juri is also a recognized Google Developer Expert in Web Technologies

Angular Performance: Route Level Code Splitting

Learn about route-level code splitting and lazy loading with Angular

2 min read

This article is part of my “Angular Performance Week” series, where I publish a new video each day based on the performance articles on web.dev/angular. Today we’re taking a look at route-level code splitting to increase the TTI of our application.

Note: this article and attached Egghead video lesson are based on the articles on web.dev/angular by Minko Gechev and Stephen Fluin. Full credit goes to them 👍

Angular Performance Series

  1. Route Level Code Splitting
  2. Preload Lazy Routes in Angular
  3. Performance budgets with the Angular CLI
  4. Optimize Angular’s Change Detection
  5. Virtual Scrolling for large lists with the CDK
  6. Precaching with the Angular Service Worker

Don’t miss the other videos by subscribing to my newsletter.

Route Level Code Splitting

TTI (Time to interactive) is an interesting metric that measures how long it takes for your app to be responsive, s.t. the user can interact. This is a good performance indicator. One way to improve TTI is to only load the minimum necessary part of our app, and then consequently “lazy load” other parts as they are needed.

In this video lesson we’re going to implement route-level code splitting and lazy loading, step by step.

Protip: Generate lazy routes with the CLI

Did you know you can use the following command to generate a new lazy route that will be hooked up on app.module.ts?

$ ng g m home --route=home --module=app.module.ts

Bonus: Showing a loading indicator for lazy routes

Original web.dev article

Wanna read the original web.dev article? Check it out here!.


Questions? Thoughts? Hit me up on Twitter
comments powered by Disqus