Hello!
I’m having a bit of trouble getting the pull to refresh working properly. Here is part of the code that’s in my controller:
$scope.refresh = function() {
PostService.load().then(function(data) {
PostService.set(data.data);
$scope.posts = PostService.get();
$scope.$broadcast('scroll.refreshComplete');
});
}
Basically when you refresh, it reloads the posts and sets the “posts” variable inside the PostService to whatever is returned by the load. Then $scope.posts is set to the “posts” variable inside PostService.
I don’t see any reason why this wouldn’t work with the code I have, but for some reason, when you refresh, it doesn’t actually reload the data, it just makes a copy of the current posts for 1 second and then goes back to how it was before. Doesn’t make any sense.
I have tried looking at the variable at all stages in this process and there are no problems there, it just seems that the $scope isn’t updating correctly. Can anyone see why this would be from the code I posted?
Many thanks!