Skip to content

ng-content doesn't project deferrable views #58110

Closed as duplicate
Closed as duplicate

Description

@twittwer

Which @angular/* package(s) are the source of the bug?

core

Is this a regression?

No

Description

It is not possible to use content projection based on CSS selectors when the projected content is in a deferrable view.
But it works when using contentChildren with structural directives and ngTemplateOutlet.
I was expecting that both approaches work the same regarding deferrable views, and it would be really nice to use @defer in simple CSS selector based content projection as well.

Please provide a link to a minimal reproduction of the bug

https://stackblitz.com/edit/stackblitz-starters-ty28hm?file=src%2Fmain.ts

Please provide the exception or error you saw

No response

Please provide the environment you discovered this bug in (run ng version)

Angular v18

Anything else?

No response

Activity

  1. modified the milestone: needsTriage on Oct 7, 2024
  2. modified the milestones: needsTriage, Backlog on Oct 16, 2024
  3. self-assigned this
    on Nov 12, 2024
  4. removed their assignment
    on Dec 5, 2024
  5. crisbeto commented on Dec 5, 2024

    @crisbeto
    Member

    I spent some time on this and I got it mostly working in this branch. It's not working fully yet, because accounting for the different projection locations during hydration will require a larger refactor. We've discussed this within the team and decided not to address the issue at the moment, but to wait and see if more users run into it. In the meantime, you can work around it by adding an <ng-container ngProjectAs="your-selector"> to control where it will be projected.

  6. levylion commented on Dec 26, 2024

    @levylion

    just encountered this issue..
    @crisbeto tnx for the workaround!

  7. twittwer commented on Jan 27, 2025

    @twittwer
    Author

    I was not able to apply this workaround, can one of you maybe show the workaround in the reproduction stackblitz?
    https://stackblitz.com/edit/stackblitz-starters-ty28hm?file=src%2Fmain.ts

    @crisbeto Thx for your try to fix it, I hope it will get some attention in the future.

  8. angular-automatic-lock-bot commented on Nov 17, 2025

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  9. locked and limited conversation to collaborators on Nov 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: coreIssues related to the framework runtimebugcore: content projectioncore: deferIssues related to @defer blocks.

    Type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions