A quick fix would be to pass in you data to the factory and let it update the variable, since it'll be a reference it'll be good.

getPage: function(pageNumber, data) { return $http.get('/feed/' + pageNumber).then(function(response) { data.push(response.data); }); }

and when calling the factory

PostData.getPage($scope.page, $scope.data);

another fix is simple just remove the then part.

getPage: function(pageNumber) { return $http.get('/feed/' + pageNumber); }

--- explaination

since you are calling multiple then on a promise.. first being inside the service

then(function(response) { return response.data; });

second being.

PostData.getPage($scope.page).then(function(returned) { $scope.data.push(returned.data); });

when you attach multiple then each one is called one after the other. the problem with your code is you are returning in the first then which prevents the 2nd to execute.. I found your first then useless so I asked you to remove it.. hence the 2nd fix.