Skip to content

Commit 525e60e

Browse files
authored
cdkConnectedOverlay directive should let us configure positioning strategy
The problem is that this directive is not flexible enough to pass in arbitrary positioning strategy.
1 parent 43a01e9 commit 525e60e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/cdk/overlay/overlay-directives.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,12 @@ export class CdkConnectedOverlay implements OnDestroy, OnChanges {
122122
/** Registered connected position pairs. */
123123
@Input('cdkConnectedOverlayPositions') positions: ConnectedPosition[];
124124

125+
/**
126+
* This input overrides the positions input if specified. It lets users pass
127+
* in arbitrary positioning strategies.
128+
*/
129+
@Input('cdkConnectedOverlayPositionStrategy') positionStrategy: FlexibleConnectedPositionStrategy;
130+
125131
/** The offset in pixels for the overlay connection point on the x-axis */
126132
@Input('cdkConnectedOverlayOffsetX')
127133
get offsetX(): number { return this._offsetX; }
@@ -284,7 +290,7 @@ export class CdkConnectedOverlay implements OnDestroy, OnChanges {
284290

285291
/** Builds the overlay config based on the directive's inputs */
286292
private _buildConfig(): OverlayConfig {
287-
const positionStrategy = this._position = this._createPositionStrategy();
293+
const positionStrategy = this._position = this.positionStrategy || this._createPositionStrategy();
288294
const overlayConfig = new OverlayConfig({
289295
direction: this._dir,
290296
positionStrategy,

0 commit comments

Comments
 (0)