title: AngularJS and getting window scroll position in controller
body: <p>I'm having some trouble understanding how to get the scroll position of window within my controller, so I can build logic around it.</p>
  
  <p>From all the questions and answers I've been reading the most accepted answer seems to be to write a directive that calculates the scroll position, stick that directive on an element, and that's it.</p>
  
  <p>However, when you want to do something along the lines of:</p>
  
  <pre><code>if (scrollY &gt; 100 ){
    $scope.showMenu = true;
  }
  
  if (scrollY &gt; 500) {
    $scope.showFooter = true;
  }
  </code></pre>
  
  <p>This approach doesn't seem to work, because the calculated position in the directive can't be accessed from the controller. What would be the right 'Angular' way of doing this, which would still allow slightly more complicated logic to be executed from the controller?</p>