-
Notifications
You must be signed in to change notification settings - Fork 6.8k
feat(portal): expose attached result in CdkPortalOutlet #9326
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
src/cdk/portal/portal-directives.ts
Outdated
@@ -93,13 +96,19 @@ export class CdkPortalOutlet extends BasePortalOutlet implements OnInit, OnDestr | |||
this._attachedPortal = portal; | |||
} | |||
|
|||
/** Component or view reference that is attached to the portal. */ | |||
get result(): ComponentRef<any> | EmbeddedViewRef<any> | null { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make more sense for the result to be emitted via @Output
rather than directly read?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure whether that would be super convenient. People would still have to save a reference to it somewhere if they want to do anything with it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'm being thrown off by calling it "result"; how about something like "attachedRef"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be flexible to have an attached
output as well thinking about it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like attachedRef
. Initially I was going to do instance
, but it would've gotten weird with the ComponentRef.instance
. I've added the attached
output as well.
Exposes the attach `ComponentRef` or `EmbeddedViewRef` in the `CdkPortalOutlet` directive. Fixes angular#9304.
49d279c
to
3d62f9d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Exposes the attach
ComponentRef
orEmbeddedViewRef
in theCdkPortalOutlet
directive.Fixes #9304.