Last active
December 26, 2015 23:29
-
-
Save djaney/7230820 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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