Using some functionality available from jQuery, I think you could:

    var space = window.innerHeight - element.offsetTop + element.offsetHeight;
     
    if (space > 0) {
        $scope.next_page();
    }