-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
feat: providing a way to get the component attached to a CdkPortalOutlet #9304
Comments
CdkPortalOutlet
Do you have a reproduction? Just looking at the source, it seems the |
The The The problem is, when using the I'll add a plunker tomorrow if still necessary. |
Exposes the attach `ComponentRef` or `EmbeddedViewRef` in the `CdkPortalOutlet` directive. Fixes angular#9304.
Exposes the attach `ComponentRef` or `EmbeddedViewRef` in the `CdkPortalOutlet` directive. Fixes angular#9304.
Exposes the attach `ComponentRef` or `EmbeddedViewRef` in the `CdkPortalOutlet` directive. Fixes #9304.
Exposes the attach `ComponentRef` or `EmbeddedViewRef` in the `CdkPortalOutlet` directive. Fixes #9304.
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. |
Bug, feature request, or proposal:
Feature request
When attaching a
ComponentPortal
to aCdkPortalOutlet
using the declarative syntaxe<ng-template [cdkPortalOutlet]="myComponentPortal">
, there is no way to get the instance of the component, created by the directive.The only way to get the component instance is to attach the portal programmaticaly, but it would seem that the cycle is not as clean as using the directive directly. When doing it in the
ngOnInit
, the view isn't initialized, and inside thengAfterViewInit
, I get the "change after it was checked" error.What is the use-case or motivation for changing an existing behavior?
Dynamically render a component, based on some
type
attribute. The developer can register it's own component to be rendered if thetype
matches. All these components implement the same interface and I need my parent component to access some methods in it. To do so, I need to get the instance created during the portal attachment.Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Angular: 5.1.3
Cdk: 5.0.3
OS: Windows 10
TS: 2.4.2
Browser: Chrome 63
The text was updated successfully, but these errors were encountered: