DEV Community

Discussion on: Dynamic Layout parts in Angular

Collapse
 
anduser96 profile image
Andrei Gatej

No, you’re right.

I think there is a way to mitigate this issue, but this implies more work from the developer.

If we don’t want to include the component in the main bundle, we can put it in its module and in the directive, based on some conditions, you can load the module on demand by using import(path/to/module).then() and injecting the compiler.

Thread Thread
 
negue profile image
negue

Yeah like you wrote, another way would be to lazy-load the components of it, there are some helper libaries for this.

I also have one 😁

Its better to have many possible ways to solve those issues, instead of none

Thread Thread
 
anduser96 profile image
Andrei Gatej • Edited

Thanks for sharing!

I’m skeptical about libraries, but I do like to explore them!