Skip to content

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

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

feat(common): expose component instance in NgComponentOutlet#58698
crisbeto wants to merge 1 commit intoangular: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
Copy link
Copy Markdown

Harpush commented Nov 16, 2024

Any chance for rendered output which passes the component ref as parameter? Mostly for class functions interactions

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
@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
Copy link
Copy Markdown
Member

@pkozlowski-opensource pkozlowski-opensource left a comment

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
Copy link
Copy Markdown
Contributor

@AndrewKushnir AndrewKushnir left a comment

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

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@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