Skip to content

Instantly share code, notes, and snippets.

@djaney
Last active December 26, 2015 23:29
Show Gist options
  • Save djaney/7230820 to your computer and use it in GitHub Desktop.
Save djaney/7230820 to your computer and use it in GitHub Desktop.
<html ng-app="app">
<body>
<div id="appBody" ng-controller="myController">
</div>
<script type="text/javascript">
var app = angular.module('app',[]);
function myController($scope){
$scope.doSomething = function(){
// do something here
};
}
// jQuery's onReady
jQuery(function($){
// scroll event
$(window).scroll(function() {
// if scroll is in bottom
if($(window).scrollTop() + $(window).height() == $(document).height()) {
// get the scope
var scope = angular.element($("#appBody")).scope();
// call a scope method
scope.doSomething();
// apply
if(!scope.$$phase) scope.$apply();
}
});
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment