angular-endless-scroll icon indicating copy to clipboard operation
angular-endless-scroll copied to clipboard

Adding additional DOM elements and scrolling within $digest cycle

Open Mead42 opened this issue 9 years ago • 0 comments

I had to modify the _onScroll function to include if (this.scope.$$phase), this allows scrolling from within another digest cycle. I was getting a $digest already in progress error. Any thoughts?

`EndlessScroller.prototype._onScroll = function () { * if (this.scope.$$phase) { // Define a throttled check method, if it's not already defined if (!this._throttledCheck) { this._throttledCheck = throttle(angular.bind(this, this.check), this.options.scrollThrottle); } // Check if there's a need to fetch more data this._throttledCheck(); } else {*

          this.scope.$apply(angular.bind(this, function() {
              // Define a throttled check method, if it's not already defined
              if (!this._throttledCheck) {
                  this._throttledCheck = throttle(angular.bind(this, this.check), this.options.scrollThrottle);
              }
              // Check if there's a need to fetch more data
              this._throttledCheck();
          }));
      }
  };`

Mead42 avatar Feb 09 '16 22:02 Mead42