Skip to content

Suggested workaround for content-projection in control flow blocks does not work #59398

@kklocker

Description

@kklocker

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

compiler-cli, compiler

Is this a regression?

No

Description

When having multiple root elements in a control flow block, the compiler gives a friendly message suggesting to

Split the content of the @case block across multiple @case blocks such that each one only has a single projectable node at its root.

This does however not seem to work as suggested (or it works but the message is unclear). In particular, this does not seem to work for ng-content with specific selector targets.

See example of reproducing here

Please provide a link to a minimal reproduction of the bug

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

Please provide the exception or error you saw

No exception.

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

Angular CLI: 18.0.0
Node: 20.14.0
Package Manager: yarn 3.4.1
OS: win32 x64

Angular: 18.2.1
... animations, cdk, common, compiler, compiler-cli, core, forms
... language-service, material, material-moment-adapter
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1802.1
@angular-devkit/build-angular   18.2.1
@angular-devkit/core            18.2.1
@angular-devkit/schematics      18.2.1
@angular/cli                    18.0.0
@schematics/angular             18.2.1
rxjs                            7.8.1
typescript                      5.5.4
webpack                         5.91.0
zone.js                         0.14.6

Anything else?

No response

Metadata

Metadata

Labels

area: docsRelated to the documentationhelp wantedAn issue that is suitable for a community contributor (based on its complexity/scope).hotlist: error messages

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions