Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Do deferrable views only work inside standalone components?

I’m trying out deferrable views and have this code in the component of a normal (NgModule-based) component.

@defer (on interaction) {
    <app-defer></app-defer>
}@placeholder {
    <p>click to load</p>
}

The DeferComponent in the @defer block is standalone, but it is included in the initial bundle. The placeholder is shown until it is clicked, but no new content is loaded in after that. However, when I make the parent component standalone, the @defer block works as expected and the DeferComponent is not loaded in until the placeholder is clicked.

Is this expected? I’m confused about this because the documentation from Angular seems to indicate that only the components in the @defer block should be standalone in order for this to work .

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

As of v17.2, yes deferrable views are only supported on standalone components.

The Angular team is looking to add support for non-standalone components in v18.
So wait & see.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading