docs-bug(CdkPortal): @ViewChild() returns undefined when using *cdkPortal instead of <ng-template cdkPortal> #21092
Labels
Comments
Hi,
Or if you want to access the TemplateRef and not the CdkPortal:
This works with both cdkPortal notation (tested in v11) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The official doc says:
However,
@ViewChild('theElementRef')
binds toundefined
when I use the*cdkPortal
notation,while it works when I use
<ng-template cdkPortal>
I suspect
*cdkPortal
makes the element to leave the page beforeafterViewInit()
.Maybe the documentation should encourage using the
<ng-template>
form instead.Affected documentation page: https://material.angular.io/cdk/portal/overview#portals-in-practice
The text was updated successfully, but these errors were encountered: