Behaviour after scroll event
<p>I have a problem using Angular2. If I'm not mistaken in Angular2 I should put my code in class instead of controller and access variables by <code>this</code> but I have a variable I want to access from function assigned to <code>window.onscroll</code>, and <code>this</code> inside this function doesn't work, because it return <code>window</code>. </p>

<p>How can I access my variables or functions on scroll event?</p>

<pre><code>class someClass{

    someVariable;

    ngOnInit() {
        this.someVariable = {}; 

        window.onscroll = function() {

            // here I want to access someVariable or someFunction

        }
    }

    someFunction() {
    }

}
</code></pre>