@@ -9,8 +9,10 @@ import {
9
9
OnDestroy ,
10
10
OnChanges ,
11
11
NgZone ,
12
- SimpleChanges
12
+ SimpleChanges ,
13
+ Inject
13
14
} from '@angular/core' ;
15
+ import { DOCUMENT } from '@angular/common' ;
14
16
import { Subject , Observable , merge } from 'rxjs' ;
15
17
import {
16
18
map ,
@@ -145,7 +147,8 @@ export class DraggableDirective implements OnInit, OnChanges, OnDestroy {
145
147
public element : ElementRef < HTMLElement > ,
146
148
private renderer : Renderer2 ,
147
149
private draggableHelper : DraggableHelper ,
148
- private zone : NgZone
150
+ private zone : NgZone ,
151
+ @Inject ( DOCUMENT ) private document : Document
149
152
) { }
150
153
151
154
ngOnInit ( ) : void {
@@ -236,10 +239,7 @@ export class DraggableDirective implements OnInit, OnChanges, OnDestroy {
236
239
'visibility' ,
237
240
'hidden'
238
241
) ;
239
- this . element . nativeElement . parentNode ! . insertBefore (
240
- clone ,
241
- this . element . nativeElement . nextSibling
242
- ) ;
242
+ this . document . body . appendChild ( clone ) ;
243
243
this . ghostElement = clone ;
244
244
245
245
this . setElementStyles ( clone , {
@@ -248,7 +248,6 @@ export class DraggableDirective implements OnInit, OnChanges, OnDestroy {
248
248
left : `${ rect . left } px` ,
249
249
width : `${ rect . width } px` ,
250
250
height : `${ rect . height } px` ,
251
- zIndex : '1000' ,
252
251
cursor : this . dragCursor ,
253
252
margin : '0'
254
253
} ) ;
0 commit comments