Skip to content

Commit

Permalink
fix(cdk/drag-drop): error if ngDevMode is undefined (#29634)
Browse files Browse the repository at this point in the history
Fixes that the drag&drop module wasn't checking for `ngDevMode` correctly.

Fixes #29633.

(cherry picked from commit 2f1fe03)
  • Loading branch information
crisbeto committed Aug 23, 2024
1 parent 32e8b26 commit 39d3d01
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/cdk/drag-drop/drag-ref.ts
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,10 @@ export class DragRef<T = any> {
const parent = element.parentNode as HTMLElement;
const placeholder = (this._placeholder = this._createPlaceholderElement());
const anchor = (this._anchor =
this._anchor || this._document.createComment(ngDevMode ? 'cdk-drag-anchor' : ''));
this._anchor ||
this._document.createComment(
typeof ngDevMode === 'undefined' || ngDevMode ? 'cdk-drag-anchor' : '',
));

// Insert an anchor node so that we can restore the element's position in the DOM.
parent.insertBefore(anchor, element);
Expand Down

0 comments on commit 39d3d01

Please sign in to comment.