title: Angular2 ngIf dynamic change
body: <p>I am using <code>*ngIf</code> for an element</p>
  
  <pre><code>&lt;div *ngFor="let el of elemenets&gt;
    &lt;div *ngIf="el.offsetTop &lt; scrollTop"&gt;
           ....
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>offsetTop represent the offsetTop of the div <code>*ngIf</code> condition is bound to.</p>
  
  <p>What I do in component is I keep the pageYOffset in the variable e.g</p>
  
  <pre><code>class Test implements onInit{
    scrollTop:number = 0;
    ngOnInit{
      window.addEventListener('scroll',function(){
          this.scrollTop = window.pageYOffset;
          console.log(this.scrollTop)
      },true)
    }
  }
  </code></pre>
  
  <p>It works when site gets loaded , but when I scroll up or down and change value of <code>scrollTop</code> variable it stays the same.</p>
  
  <p>If I understood it correctly , <code>*ngIf</code> watch changes so when scrollTop variable changes it should  again evaluate condition, but it does not in my case.</p>
  
  <p>Is there a solution to my problem or do I have to find different approach?
  Thanks</p>