Skip to content

Dynamically generated content is not projected #54872

@csisy-bt4w

Description

@csisy-bt4w

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

Don't known / other

Is this a regression?

Yes

Description

It looks like that the new template pipeline which is enabled by default since version 17.3.0 does not properly handle projected contant which is created dynamically.

As you can see in the stackblitz example, if the element is statically added as a child of the container element, it is properly projected. However, if the content is dynamically created (e.g. with an if or for), then the container will be empty.

It seems to be a rendering/DOM issue only, because the children are properly queried (see the console output).

Might be related: #54840

Please provide a link to a minimal reproduction of the bug

https://stackblitz.com/edit/stackblitz-starters-nnuszu?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 CLI: 17.3.0
Node: 18.18.0
Package Manager: npm 10.2.3
OS: linux x64

Angular: 17.3.0
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1703.0
@angular-devkit/build-angular   17.3.0
@angular-devkit/core            17.3.0
@angular-devkit/schematics      17.3.0
@schematics/angular             17.3.0
rxjs                            7.8.1
typescript                      5.4.2
zone.js                         0.14.4

Anything else?

The ng version is printed by the stackblitz example, we have the exact same versions except the OS which is not related in this case.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions