Skip to content

fix(upgrade): only compile the template contents of a downgraded component - #71442

Open
SkyZeroZx wants to merge 1 commit into
angular:mainfrom
SkyZeroZx:fix/upgrade-projected-content-compile
Open

SkyZeroZx wants to merge 1 commit into
angular:mainfrom
SkyZeroZx:fix/upgrade-projected-content-compile

Conversation

@SkyZeroZx

Copy link
Copy Markdown
Contributor

Previously, a downgraded component compiled whatever its element contained when the component was created. By then, AngularJS could already have linked or written content into the element, for example through ng-transclude or ng-bind on it, and that content was compiled again.

The contents are now copied when the directive's controller is instantiated, before anything on the element is linked, and that copy is what gets compiled. If there is nothing to copy, whatever AngularJS put into the element is projected as it is, so content added by ng-transclude keeps the scope it was linked with.

Fixes #71441

…onent

Previously, a downgraded component compiled whatever its element contained when the component was created. By then, AngularJS could already have linked or written content into the element, for example through `ng-transclude` or `ng-bind` on it, and that content was compiled again.

The contents are now copied when the directive's controller is instantiated, before anything on the element is linked, and that copy is what gets compiled. If there is nothing to copy, whatever AngularJS put into the element is projected as it is, so content added by `ng-transclude` keeps the scope it was linked with.

Fixes angular#71441
@angular-robot angular-robot Bot added the area: upgrade Issues related to AngularJS → Angular upgrade APIs label Oct 20, 2026
@ngbot ngbot Bot added this to the Backlog milestone Oct 20, 2026
@SkyZeroZx
SkyZeroZx marked this pull request as ready for review October 20, 2026 14:49
@pullapprove
pullapprove Bot requested a review from kirjs October 20, 2026 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: upgrade Issues related to AngularJS → Angular upgrade APIs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

downgradeComponent() compiles content that AngularJS directives wrote into its element

1 participant