-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Description
actually, I m not 100% confirm this is a bug or is by design. because document not very clear for this part.
Reproduction
https://github.com/keatkeat87/ng-mat-portal-outlet-issue

Expected Behavior
the portal should render in outlet not view container.
Actual Behavior
the portal render in view container.
more details:
I check the source code, class CdkPortalOutlet

as the comment said that
// If the portal specifies an origin, use that as the logical location of the component
// in the application tree. Otherwise use the location of this PortalOutlet.
if i not wrong, logical location is not equal to render location, so in this part, should have some code to move the element to outlet location.
i think it should work same as DomPortalOutlet

in the end, move element to outlet.
another interesting thing is in class CdkPortalOutlet
when we attach a templatePortal, it just ignore the templatePortal viewContainerRef.

it work not same as attach a component portal. it really make user confusing.
Environment
- Angular: 9.0.0 rc1
- CDK/Material: 9.0.0 rc 0
- Browser(s): chrome latest
- Operating System (e.g. Windows, macOS, Ubuntu): windows 10