Tutorial hero
Lesson icon

Auto Unwrapping Routes

Originally published December 08, 2022 Time 1 mins

A reasonably small but nice quality of life feature available in Angular 15 is auto unwrapping with default exports when using loadComponent or loadChildren.

Typically, if we wanted to set up a lazy route we would do this:

lazy route

We wait for the import to resolve, and then we need to specify which export from that module we want to use.

Now, what we can do instead is mark a default export in the file we are importing:

mark a default export in the file we are importing

Then we can just import that directly like this:

imports

Nothing revolutionary here, but a nice little improvement!

Learn to build modern Angular apps with my course