angular/components
docs-bug(CdkPortal): @ViewChild() returns undefined when using *cdkPortal instead of <ng-template cdkPortal>
Fechada
#21.092 aberto em 19 de nov. de 2020
P3area: cdk/portaldocsgood first issuehelp wanted
Métricas do repositório
- Stars
- (24.044 estrelas)
- Métricas de merge de PR
- (Mesclagem média 3d 12h) (98 fundiu PRs em 30d)
Description
The official doc says:
However, @ViewChild('theElementRef') binds to undefined 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 before afterViewInit().
Maybe the documentation should encourage using the <ng-template> form instead.
Affected documentation page: https://material.angular.io/cdk/portal/overview#portals-in-practice