Skip to content

Commit

Permalink
fix(overlay): detach method returns undefined
Browse files Browse the repository at this point in the history
Currently the JSDoc of the `detach` method describes that the method returns a Promise if the detaching is done. This is not the case and just `undefined` is being returned because every `PortalHost` implementation inside of the CDK is synchronously detaching the view.

In the future it might be useful to change this method back to a `Promise` in favor of animations, but for now it doesn't make sense return a `Promise` because the `attach` method is also synchronous.

Fixes angular#7408
  • Loading branch information
devversion committed Sep 30, 2017
1 parent 01622b1 commit 0fa6ed4
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/cdk/overlay/overlay-ref.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,8 @@ export class OverlayRef implements PortalHost {
return attachResult;
}

/**
* Detaches an overlay from a portal.
* @returns Resolves when the overlay has been detached.
*/
detach(): Promise<any> {
/** Detaches an overlay from a portal. */
detach(): void {
this.detachBackdrop();

// When the overlay is detached, the pane element should disable pointer events.
Expand All @@ -99,12 +96,10 @@ export class OverlayRef implements PortalHost {
this._config.scrollStrategy.disable();
}

let detachmentResult = this._portalHost.detach();
this._portalHost.detach();

// Only emit after everything is detached.
this._detachments.next();

return detachmentResult;
}

/**
Expand Down

0 comments on commit 0fa6ed4

Please sign in to comment.