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

Method dispose

src/cdk/overlay/overlay-ref.ts:278–314  ·  view source on GitHub ↗

Cleans up the overlay from the DOM.

()

Source from the content-addressed store, hash-verified

276
277 /** Cleans up the overlay from the DOM. */
278 dispose(): void {
279 if (this._disposed) {
280 return;
281 }
282
283 const isAttached = this.hasAttached();
284
285 if (this._positionStrategy) {
286 this._positionStrategy.dispose();
287 }
288
289 this._disposeScrollStrategy();
290 this._backdropRef?.dispose();
291 this._locationChanges?.();
292 this._keyboardDispatcher.remove(this);
293 this._portalOutlet.dispose();
294 this._attachments.complete();
295 this._backdropClick.complete();
296 this._keydownEvents.complete();
297 this._outsidePointerEvents.complete();
298 this._outsideClickDispatcher.remove(this);
299 this._host?.remove();
300 this._afterNextRenderRef?.destroy();
301 this._previousHostParent = this._pane = this._host = this._backdropRef = null!;
302
303 if (isAttached) {
304 this._detachments.next();
305 }
306
307 this._detachments.complete();
308 this._completeDetachContent();
309 this._disposed = true;
310
311 untracked(() => {
312 attachedOverlaysInternal.update(prev => prev.filter(o => o !== this));
313 });
314 }
315
316 /** Whether the overlay has attached content. */
317 hasAttached(): boolean {

Callers 1

attachMethod · 0.95

Calls 9

hasAttachedMethod · 0.95
disposeMethod · 0.65
removeMethod · 0.65
destroyMethod · 0.65
updateMethod · 0.65
nextMethod · 0.45
filterMethod · 0.45

Tested by

no test coverage detected