I'm having some trouble understanding how to get the scroll position of window within my controller, so I can build logic around it.
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.
However, when you want to do something along the lines of:
if (scrollY > 100 ){
$scope.showMenu = true;
}
if (scrollY > 500) {
$scope.showFooter = true;
}
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?