DEV Community

Sanjay Patel
Sanjay Patel

Posted on

2 2

Dynamic imports for lazy routes from old towards new: Angular 8

Lazy-loaded routes now use the standard dynamic import syntax instead of a custom string. This means that TypeScript and linters will be better able to complain when modules are missing or misspelled.

So a lazy-loaded import that looked like this:

{ path: '/cart', loadChildren: './cart/cart.module#CartModule' }

Will now look like this:

{ path:/cart, loadChildren: () => import(./cart/cart.module).then(m => m.CartModule) }

The change in syntax will be taken care of for you if you’re using the ng upgrade command to upgrade your app.

Know more about updates on Angular 8 here

Top comments (1)

Collapse
 
matheusmurta profile image
Matheus Gonçalves Murta

thanks you save my day

Qodo Takeover

Introducing Qodo Gen 1.0: Transform Your Workflow with Agentic AI

Rather than just generating snippets, our agents understand your entire project context, can make decisions, use tools, and carry out tasks autonomously.

Read full post

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay