diff --git a/src/cdk/overlay/overlay-ref.ts b/src/cdk/overlay/overlay-ref.ts index c1909d2e9beb..9fc473a37e68 100644 --- a/src/cdk/overlay/overlay-ref.ts +++ b/src/cdk/overlay/overlay-ref.ts @@ -106,13 +106,14 @@ export class OverlayRef implements PortalOutlet, OverlayReference { * @returns The portal attachment result. */ attach(portal: Portal): any { - let attachResult = this._portalOutlet.attach(portal); - - // Update the pane element with the given configuration. + // Insert the host into the DOM before attaching the portal, otherwise + // the animations module will skip animations on repeat attachments. if (!this._host.parentElement && this._previousHostParent) { this._previousHostParent.appendChild(this._host); } + const attachResult = this._portalOutlet.attach(portal); + if (this._positionStrategy) { this._positionStrategy.attach(this); }