Skip to content

Adding additional DOM elements and scrolling within $digest cycle #10

Description

@Mead42

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();
          }));
      }
  };`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions