'enabling lazy load for angular component
<div class="flex-container-new">
<div class="header-alert-gauges">
<div style="margin: 0px 2px 0px 26px;">
<dashboard-header></dashboard-header>
</div>
<div class="alret-container" style="margin:25px 5px 2px 26px;">
**<dashboard-body></dashboard-body>**
</div>
</div>
<div class="dashboard-aside-MFN">
<dashboard-aside class="dashboard-aside-flex-container"></dashboard-aside>
</div>
</div>
How can I make dashboard-body lazy load, can some some share the sample code or any link available where I can refer.
Solution 1:[1]
I think you can refer to the following post.
https://medium.com/angular-in-depth/lazy-load-components-in-angular-596357ab05d8
But it's a little bit complicated. So you can rather use ngIf
and implement a conditional rendering with some boolean variable.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | David Lu |