Skip to content

Default ng-content fallback doesn't work with custom elements or dynamic components using projectableNodes #57471

@chintankavathia

Description

@chintankavathia

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

elements, core

Is this a regression?

No

Description

With Angular v18 we can now use default fallback content inside ng-content
This doesn't seem to work when component is rendered as custom element.

Update:

This also doesn't work when creating component dynamically using createComponent and providing projectableNodes.

Please provide a link to a minimal reproduction of the bug

https://stackblitz.com/edit/stackblitz-starters-zbqyg7?description=An%20angular-cli%20project%20based%20on%20@angular/animations,%20@angular/common,%20@angular/compiler,%20@angular/core,%20@angular/forms,%20@angular/platform-browser,%20@angular/platform-browser-dynamic,%20@angular/router,%20core-js,%20rxjs,%20tslib%20and%20zone.js&file=package.json,src%2Ftest-element.component.ts,src%2Fmain.ts,src%2Findex.html&template=node&title=Angular%20Starter

Please provide the exception or error you saw

No response

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

Angular CLI: 18.2.0
Node: 18.20.3
Package Manager: npm 10.2.3
OS: linux x64

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

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1802.0
@angular-devkit/build-angular   18.2.0
@angular-devkit/core            18.2.0
@angular-devkit/schematics      18.2.0
@schematics/angular             18.2.0
rxjs                            7.8.1
typescript                      5.5.4
zone.js                         0.14.10

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions