Bug
CDK overlay panel should get inline width and height properties defined by the 'width' and 'height' entries in the config.
The overlay panel is rendered without any width or height. The 'height' property is defined in overlayConfig: https://github.com/angular/material2/blob/master/src/cdk/overlay/overlay-config.ts, and is also documented in the the Overlay API
Angular 5.1.3, cdk 5.0.3, Typescript 2.6.2, windows 10, Chrome v63
Your work and effort is much appreciated here!
I think this is a result of both the OverlayRef and the GlobalPositionStrategy having a width property for some historical reasons. The one in the GlobalPositionStrategy ends up overriding the one from the OverlayRef. I'll submit a fix, but until it gets in you should be able to work around it like this:
this.overlay.position()
.global()
.centerHorizontally()
.centerVertically()
.width('300px');
@crisbeto - good workaround. Thanks!
Although when I tried it in the same order of methods that you wrote, .centerHorizontally() and .centerVertically() were ignored - the result was that the overlay-wrapper's inlined flex properties were flex-start on both vertical and horizontal.
But once I moved the width before .centerHorizontally() and .centerVertically(), the result was a dialog properly centered.
....
.width('300px');
.centerHorizontally()
.centerVertically()
Not sure why it's like that
The workaround is great, but how one should do with a flexibleConnectedTo position ? Nothing offers a width function ...
typescript
this.overlay
.position()
.flexibleConnectedTo(anchor)
.withPositions(positions);
Angular 8 : height is working, width is still KO with a flexibleConnectedTo position.
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
_This action has been performed automatically by a bot._
Most helpful comment
The workaround is great, but how one should do with a
flexibleConnectedToposition ? Nothing offers awidthfunction ...typescript this.overlay .position() .flexibleConnectedTo(anchor) .withPositions(positions);