angular2-draggable icon indicating copy to clipboard operation
angular2-draggable copied to clipboard

Bounds element from different component

Open jansedlon opened this issue 7 years ago • 2 comments

If I set an element from different component to bounds, it doesn't work. Any ideas how to deal with it?

jansedlon avatar Jun 11 '18 11:06 jansedlon

same problem here, I tried with a DIV id but it doesn't work

ghost avatar Jul 11 '18 13:07 ghost

found the solution ! Here is your parent component :

<div #mainDiv>
      <childComponent [parentContainer]="mainDiv"></childComponent>
</div>

And your child component :

<div ngDraggable [bounds]="parentContainer" [inBounds]="true"> yeah </div>
export class ChildComponent implements OnInit {

  @Input()  parentContainer: ElementRef;

  constructor() {  }
  ngOnInit() {}
}

ghost avatar Jul 11 '18 13:07 ghost