Skip to content

refactor(compiler): support matching template elements to foreign components#68674

Draft
leonsenft wants to merge 6 commits into
angular:mainfrom
leonsenft:foreign-component
Draft

refactor(compiler): support matching template elements to foreign components#68674
leonsenft wants to merge 6 commits into
angular:mainfrom
leonsenft:foreign-component

Conversation

@leonsenft
Copy link
Copy Markdown
Contributor

This is currently based on #68643

We extract the identifier name from the foreignImports expression in ComponentDecoratorHandler and use a SelectorlessMatcher to match element tags against these names during template binding in R3TargetBinder. If an element matches both a regular Angular directive and a foreign component, a conflict error is thrown.

alxhub and others added 3 commits April 22, 2026 11:47
Creates the foreign view mechanism to support standard ViewContainerRef
using a dedicated ɵForeignViewRef implementation. Updates tests to use
public APIs (vcr.detach and vcr.insert), asserts on total innerHTML, and
exports ɵForeignViewRef privately from core.
This adds the new (internal) `applyForeignNodes()` function to the
bundle goldens.
@angular-robot angular-robot Bot added detected: feature PR contains a feature commit area: compiler Issues related to `ngc`, Angular's template compiler area: core Issues related to the framework runtime labels May 11, 2026
@ngbot ngbot Bot added this to the Backlog milestone May 11, 2026
leonsenft added 2 commits May 11, 2026 14:07
- Added the ForeignComponent type in @angular/core.
- Added Component.foreignImports for importing ForeignComponents.
- Updated the compiler to handle ForeignComponent in template dependencies.
- Updated ngtsc to extract foreignImports from standalone components.

Note the compiler doesn't do anything yet with these imports.
- Added the ForeignComponent type in @angular/core.
- Added Component.foreignImports for importing ForeignComponents.
- Updated the compiler to handle ForeignComponent in template dependencies.
- Updated ngtsc to extract foreignImports from standalone components.

Note the compiler doesn't do anything yet with these imports.
@leonsenft leonsenft added the target: patch This PR is targeted for the next patch release label May 11, 2026
…ponents

We extract the identifier name from the `foreignImports` expression in
`ComponentDecoratorHandler` and use a `SelectorlessMatcher` to match element
tags against these names during template binding in `R3TargetBinder`. If an
element matches both a regular Angular directive and a foreign component, a
conflict error is thrown.
@leonsenft leonsenft force-pushed the foreign-component branch from 4f1461e to ef66ea2 Compare May 11, 2026 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: compiler Issues related to `ngc`, Angular's template compiler area: core Issues related to the framework runtime detected: feature PR contains a feature commit target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants