code: function defaultHandler() {
          let containerBottom;
          let elementBottom;
          if (container === windowElement) {
            containerBottom = height(container) + pageYOffset(container[0].document.documentElement);
            elementBottom = offsetTop(elem) + height(elem);
          } else {
            containerBottom = height(container);
            let containerTopOffset = 0;
            if (offsetTop(container) !== undefined) {
              containerTopOffset = offsetTop(container);
            }
            elementBottom = (offsetTop(elem) - containerTopOffset) + height(elem);
          }
  
          if (useDocumentBottom) {
            elementBottom = height((elem[0].ownerDocument || elem[0].document).documentElement);
          }
  
          const remaining = elementBottom - containerBottom;
          const shouldScroll = remaining <= (height(container) * scrollDistance) + 1;
  
          if (shouldScroll) {
            checkWhenEnabled = true;
  
            if (scrollEnabled) {
              if (scope.$$phase || $rootScope.$$phase) {
                scope.infiniteScroll();
              } else {
                scope.$apply(scope.infiniteScroll);
              }
            }
          } else {
            if (checkInterval) { $interval.cancel(checkInterval); }
            checkWhenEnabled = false;
          }
        }
docs: infinite-scroll specifies a function to call when the window, or some other container specified by infinite-scroll-container, is scrolled within a certain range from the bottom of the document. It is recommended to use infinite-scroll-disabled with a boolean that is set to true when the function is called in order to throttle the function call.