Tracking position on Scroll in Angular2 not working in IE
<p>I did create a directive to pin or unpin an header. Here is the HostListener on scroll. It works very well in Chrome/Firefox and Edge. However on IE11, everytime I do scroll, the function is called something like 5 times, thus breaking my logic. Anything I could do to prevent that from happening ? </p>

<pre><code>   @HostListener("window:scroll", ["$event"])
    doSomething(event) {
      let topOffset = document.documentElement.scrollTop || document.body.scrollTop

      if(topOffset &gt; this.scrollPosition) {
        this.el.classList.remove("pinned")
        this.el.classList.add("unpinned")
      }
      else {
        this.el.classList.remove("unpinned")
        this.el.classList.add("pinned")
      }
      this.scrollPosition = topOffset
    }
</code></pre>

<p>I am using Angular2 Beta-17 with : <code>es6-shim/es6-shim.min.js</code> and <code>es6/dev/src/testing/shims_for_IE.js</code></p>

<p>Edit: Is it normal and would the solution be simply using a debounce pattern ?</p>