Skip to content

Commit

Permalink
cdkConnectedOverlay directive should let us configure positioning st…
Browse files Browse the repository at this point in the history
…rategy

The problem is that this directive is not flexible enough to pass in arbitrary positioning strategy.
  • Loading branch information
mertdeg2 authored Jun 24, 2019
1 parent 43a01e9 commit 525e60e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/cdk/overlay/overlay-directives.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,12 @@ export class CdkConnectedOverlay implements OnDestroy, OnChanges {
/** Registered connected position pairs. */
@Input('cdkConnectedOverlayPositions') positions: ConnectedPosition[];

/**
* This input overrides the positions input if specified. It lets users pass
* in arbitrary positioning strategies.
*/
@Input('cdkConnectedOverlayPositionStrategy') positionStrategy: FlexibleConnectedPositionStrategy;

/** The offset in pixels for the overlay connection point on the x-axis */
@Input('cdkConnectedOverlayOffsetX')
get offsetX(): number { return this._offsetX; }
Expand Down Expand Up @@ -284,7 +290,7 @@ export class CdkConnectedOverlay implements OnDestroy, OnChanges {

/** Builds the overlay config based on the directive's inputs */
private _buildConfig(): OverlayConfig {
const positionStrategy = this._position = this._createPositionStrategy();
const positionStrategy = this._position = this.positionStrategy || this._createPositionStrategy();
const overlayConfig = new OverlayConfig({
direction: this._dir,
positionStrategy,
Expand Down

0 comments on commit 525e60e

Please sign in to comment.