Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ngInfiniteScroll is firing two times in the call stack for single initialisation #374

Open
swatjoshi opened this issue Jan 12, 2018 · 1 comment

Comments

@swatjoshi
Copy link

Hi
I am trying to achieve infinite scrolling for dynamic data coming from server, but sometimes I am getting two responses even-though client is firing single request. On debugging I see nginfinite-scroll.min.dir.js is getting called twice in call stack so I am receiving two responses.
Can you please help me in fixing this problem?
Thank you

@brazorf
Copy link

brazorf commented Jan 17, 2018

I've a similar issue. This is my controller

function loadNodes(ipp, page) {
    return api.data().sort('created_at', 'desc').paginate('node', ipp, page);
}

$scope.nodes = [];

var page = 0, ipp = 15;

$scope.loadMore = function() {
	loadNodes(ipp, ++page).then(function(response){
		$scope.nodes = $scope.nodes.concat(response.data);
	});
}

and this is pretty much my view

<div class="card-columns"
	 infinite-scroll="loadMore()"
	 infinite-scroll-use-document-bottom="true">
	<node-card node="n" ng-repeat="n in nodes"></node-card>
</div>

I kind of fixed this by adding a "load in progress flag" and adding this option infinite-scroll-disabled="loading", but the issue itself remains.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants