Skip to content

CdkPortalOutlet hasAttached not called when using attachComponentPortal #8628

Closed
@probert94

Description

@probert94

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?

  1. Create a Component, which contains a cdkPortalOutlet.
  2. Get a reference to the CdkPortalOutlet-Directive using @ViewChild(CdkPortalOutlet).
  3. Attach a Template to it, using attachTemplatePortal.
  4. 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.

Metadata

Metadata

Assignees

Labels

P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions