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

Method dispose

src/cdk/drag-drop/drag-ref.ts:538–575  ·  view source on GitHub ↗

Removes the dragging functionality from the DOM element.

()

Source from the content-addressed store, hash-verified

536
537 /** Removes the dragging functionality from the DOM element. */
538 dispose() {
539 this._removeRootElementListeners();
540
541 // Do this check before removing from the registry since it'll
542 // stop being considered as dragged once it is removed.
543 if (this.isDragging()) {
544 // Since we move out the element to the end of the body while it's being
545 // dragged, we have to make sure that it's removed if it gets destroyed.
546 this._rootElement?.remove();
547 }
548
549 this._marker?.remove();
550 this._destroyPreview();
551 this._destroyPlaceholder();
552 this._dragDropRegistry.removeDragItem(this);
553 this._removeListeners();
554 this.beforeStarted.complete();
555 this.started.complete();
556 this.released.complete();
557 this.ended.complete();
558 this.entered.complete();
559 this.exited.complete();
560 this.dropped.complete();
561 this._moveEvents.complete();
562 this._handles = [];
563 this._disabledHandles.clear();
564 this._dropContainer = undefined;
565 this._resizeSubscription.unsubscribe();
566 this._parentPositions.clear();
567 this._boundaryElement =
568 this._rootElement =
569 this._ownerSVGElement =
570 this._placeholderTemplate =
571 this._previewTemplate =
572 this._marker =
573 this._parentDragRef =
574 null!;
575 }
576
577 /** Checks whether the element is currently being dragged. */
578 isDragging(): boolean {

Callers

nothing calls this directly

Calls 8

isDraggingMethod · 0.95
_destroyPreviewMethod · 0.95
_destroyPlaceholderMethod · 0.95
_removeListenersMethod · 0.95
removeDragItemMethod · 0.80
removeMethod · 0.65
clearMethod · 0.65

Tested by

no test coverage detected