feat(common): expose component instance in NgComponentOutlet by crisbeto · Pull Request #58698 · angular/angular · GitHub
Skip to content

feat(common): expose component instance in NgComponentOutlet#58698

Closed
crisbeto wants to merge 1 commit into
angular:mainfrom
crisbeto:component-outlet-instance
Closed

feat(common): expose component instance in NgComponentOutlet#58698
crisbeto wants to merge 1 commit into
angular:mainfrom
crisbeto:component-outlet-instance

Conversation

@crisbeto

Copy link
Copy Markdown
Member

Exposes the current instance of the component in the NgComponentOutlet directive.

@crisbeto crisbeto added action: review The PR is still awaiting reviews from at least one requested reviewer target: minor This PR is targeted for the next minor release labels Nov 16, 2024
@pullapprove pullapprove Bot requested a review from thePunderWoman November 16, 2024 08:33
@angular-robot angular-robot Bot added detected: feature PR contains a feature commit area: common Issues related to APIs in the @angular/common package labels Nov 16, 2024
@ngbot ngbot Bot added this to the Backlog milestone Nov 16, 2024
@Harpush

Harpush commented Nov 16, 2024

Copy link
Copy Markdown

Comment thread packages/common/src/directives/ng_component_outlet.ts Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this were Type<T> then type inference would probably work from the template; that could be relevant if this directive were to also have exportAs to be able to access the component instance from a template reference instead of contentChild.

The T defaulting to unknown may be a breaking change concern in that case.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO it should be Type<T>, I just missed to do it the first time around. I'll run a TGP to see how breaking it would be in practice. Maybe also default it to any instead?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There were a couple of failures in the TGP so I think we'll have to do it in a major. I left a TODO.

@crisbeto crisbeto force-pushed the component-outlet-instance branch from fb07d1a to cdbe98c Compare November 16, 2024 10:44
Comment thread packages/common/test/directives/ng_component_outlet_spec.ts Outdated
@crisbeto crisbeto force-pushed the component-outlet-instance branch from cdbe98c to d247593 Compare November 17, 2024 12:40
Exposes the current instance of the component in the `NgComponentOutlet` directive.
@crisbeto crisbeto force-pushed the component-outlet-instance branch from d247593 to 12bb7d4 Compare November 17, 2024 12:43

@pkozlowski-opensource pkozlowski-opensource left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Reviewed-for: public-api
Reviewed-for: fw-common

@pullapprove pullapprove Bot requested a review from alxhub November 20, 2024 09:04

@AndrewKushnir AndrewKushnir left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed-for: public-api

@AndrewKushnir AndrewKushnir removed the action: review The PR is still awaiting reviews from at least one requested reviewer label Nov 20, 2024
@crisbeto crisbeto added the action: merge The PR is ready for merge by the caretaker label Nov 20, 2024
@AndrewKushnir

Copy link
Copy Markdown
Contributor

This PR was merged into the repository by commit e4c50b3.

The changes were merged into the following branches: main

@angular-automatic-lock-bot

Copy link
Copy Markdown

@angular-automatic-lock-bot angular-automatic-lock-bot Bot locked and limited conversation to collaborators Dec 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker area: common Issues related to APIs in the @angular/common package detected: feature PR contains a feature commit target: minor This PR is targeted for the next minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants