MCPcopy Create free account
hub / github.com/angular/components / close

Method close

src/cdk/dialog/dialog-ref.ts:102–116  ·  view source on GitHub ↗

* Close the dialog. * @param result Optional result to return to the dialog opener. * @param options Additional options to customize the closing behavior.

(result?: R, options?: DialogCloseOptions)

Source from the content-addressed store, hash-verified

100 * @param options Additional options to customize the closing behavior.
101 */
102 close(result?: R, options?: DialogCloseOptions): void {
103 if (this._canClose(result)) {
104 const closedSubject = this.closed as Subject<R | undefined>;
105 this.containerInstance._closeInteractionType = options?.focusOrigin || 'program';
106 // Drop the detach subscription first since it can be triggered by the
107 // `dispose` call and override the result of this closing sequence.
108 this._detachSubscription.unsubscribe();
109 this.overlayRef.dispose();
110 closedSubject.next(result);
111 closedSubject.complete();
112 (this as {componentInstance: C}).componentInstance = (
113 this as {containerInstance: DialogContainer}
114 ).containerInstance = null!;
115 }
116 }
117
118 /** Updates the position of the dialog based on the current position strategy. */
119 updatePosition(): this {

Callers 4

constructorMethod · 0.95
closeAllMethod · 0.45
ngOnDestroyMethod · 0.45
dialog.spec.tsFile · 0.45

Calls 3

_canCloseMethod · 0.95
disposeMethod · 0.65
nextMethod · 0.45

Tested by

no test coverage detected