Closed
Description
Bug, feature request, or proposal:
Bug report
What is the expected behavior?
When I attach a Component
or a Template
to a CdkPortalOutlet
using attachComponentPortal
or attachTemplatePortal
, I expect that hasAttached
returns true.
What is the current behavior?
hasAttached
always returns false, except, when using the cdkPortalOutlet
-input t oset the portal
.
What are the steps to reproduce?
- Create a
Component
, which contains acdkPortalOutlet
. - Get a reference to the
CdkPortalOutlet
-Directive using@ViewChild(CdkPortalOutlet)
. - Attach a
Template
to it, usingattachTemplatePortal
. - Call
hasAttached()
which should return false.
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
I am using Angular Material+CDK version 5.0.0-rc.1 as awell as Angular version 5.0.3
Is there anything else we should know?
The problem is in portal-directives.ts#L114 and portal-directives.ts#L129, where this._portal = portal
should probably be this.portal = portal
, so that the setter is called and updates the _attachedPortal
of the super-class.