Ionic infinite scroll not working proper


#1

hi i am new in ionic i am using ionic infinite scroll its working but not proper.if i have 50 records then first it show all the product after that we scroll its load same 50 products again i dont know how to add limit there or any type validation.here is my code

.controller(‘HomeCtrl’, function($scope, $stateParams,$http,$ionicLoading) {

$scope.latests = [];

$scope.loadMore = function(){

var parameters = {
	
	id: $scope.lastproductID
};	

	
 $http.get('http://mydomain.com/latest.php',{ params : parameters }).success(function(items) {
	 
  $scope.lastproductID = $scope.latests.id;
  
  angular.forEach(items,function(item){
	 
		$scope.latests.push(item);
		
  });
  
  $scope.$broadcast('scroll.infiniteScrollComplete');
  
});
	
};