title: Angular 2 window.scrollTo not Working?
body: <p>I am trying to have it so a my div element, set to "overflow:auto" will scroll when the user is dragging an element.</p>
  
  <p>Dragging the element works, and so does retrieving the proper mouse data (such as the x/y position upon initial drag (onDragStart) and also the current x/y position when the mouse is moving.</p>
  
  <p>I realize my logic for the scrolling probably is off, but I am more just trying to get the div element to scroll at all. Any insight as to what is wrong would be greatly appreciated...Material Design is also being used.</p>
  
  <p>Note: I am using ng-metadata which ports Angular 1 to look like Angular 2, really any guidance in either Angular 1 or Angular 2 would be helpful.</p>
  
  <pre><code>@autobind
  onDragStart({clientX, clientY}) {
    this.initY = clientY;
    if (this.isDragging) return;
    document.addEventListener('mousemove', this.dragListener = (e) =&gt; {
    e.preventDefault();
    if (Math.max(Math.abs(e.clientX - clientX), Math.abs(e.clientY - clientY)) &gt; 3) {
      document.removeEventListener('mousemove', this.dragListener);
      document.addEventListener('mousemove', this.onDrag);
      this.dragListener = this.onDrag;
      this.fileService.dragSource = this.file;
      // onDrag needs to be called before Angular can set the proper classes
      this._element.toggleClass('dragging', this.isDragging);
      this._element.toggleClass('bulk-dragging', this.inBulkDragOp);
      this.onDragScroll(e);
      this.onDrag(e);
      this.drag.emit();
      this._scope.$applyAsync();
    }
  });
  }
  
  @autobind
  onDrag(e) {
    console.log("Dragging...");
    console.log(e);
    var currentY = e.clientY;
    var range = 100; // Range of 100px before scrolling begins... May need tweaking if too responsive
  
  if (currentY &gt; this.initY + range) {
    console.log("SCROLL DOWN");
    window.scrollTo(0, 500);
  } else if (currentY &lt; this.initY - range) {
    console.log("SCROLL UP");
  }
  e.preventDefault();
  this._element.css('transform', `translate(${e.clientX - this._element[0].clientWidth / 2}px, ${e.clientY - this._element[0].clientHeight / 2}px)`);
  }
  </code></pre>