Refactoring of scroll events using $scope.$emit