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

Method _createPlaceholderElement

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

Creates an element that will be shown instead of the current element while dragging.

()

Source from the content-addressed store, hash-verified

1220
1221 /** Creates an element that will be shown instead of the current element while dragging. */
1222 private _createPlaceholderElement(): HTMLElement {
1223 const placeholderConfig = this._placeholderTemplate;
1224 const placeholderTemplate = placeholderConfig ? placeholderConfig.template : null;
1225 let placeholder: HTMLElement;
1226
1227 if (placeholderTemplate) {
1228 this._placeholderRef = placeholderConfig!.viewContainer.createEmbeddedView(
1229 placeholderTemplate,
1230 placeholderConfig!.context,
1231 );
1232 this._placeholderRef.detectChanges();
1233 placeholder = getRootNode(this._placeholderRef, this._document);
1234 } else {
1235 placeholder = deepCloneNode(this._rootElement);
1236 }
1237
1238 // Stop pointer events on the preview so the user can't
1239 // interact with it while the preview is animating.
1240 placeholder.style.pointerEvents = 'none';
1241 placeholder.classList.add(PLACEHOLDER_CLASS);
1242 return placeholder;
1243 }
1244
1245 /**
1246 * Figures out the coordinates at which an element was picked up.

Callers 1

_startDragSequenceMethod · 0.95

Calls 3

getRootNodeFunction · 0.90
deepCloneNodeFunction · 0.90
addMethod · 0.45

Tested by

no test coverage detected