Advertisement
Guest User

Untitled

a guest
Apr 17th, 2014
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. $http.get('http://api.discogs.com/artists/' + $scope.artist.id + '/releases?page=' + $scope.nextPage + '&per_page=8').then(function(data2) {
  2. $scope.nextPage = $scope.nextPage + 1;
  3. if($scope.nextPage > data2.data.pagination.pages){
  4. $scope.morePages = false;
  5. }
  6. $scope.releases = $scope.releases.concat(data2.data.releases);
  7. })
  8. .finally(function(){
  9. $scope.loading = false;
  10. });
  11.  
  12. $http({method: 'GET', url: 'http://localhost:3000/api/symbol/junk',
  13. headers:{
  14. 'Access-Control-Allow-Origin': '*',
  15. 'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, OPTIONS',
  16. 'Access-Control-Allow-Headers': 'Content-Type, X-Requested-With',
  17. 'X-Random-Shit':'123123123'
  18. }})
  19. .success(function(d){ console.log( "yay" ); })
  20.  
  21. var makeCall = function(artistId,etc...,callBackFunc){
  22. var config={method: 'GET',
  23. url: 'http://api.discogs.com/artists/',
  24. params:{artistId:artistId,etc....}
  25. headers:{
  26. 'Access-Control-Allow-Origin': '*',
  27. 'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, OPTIONS',
  28. 'Access-Control-Allow-Headers': 'Content-Type, X-Requested-With',
  29. 'X-Random-Shit':'123123123'
  30. }};
  31. $http(config).then(function(data){
  32. callBackFunc(data);
  33. })
  34. }
  35.  
  36. myService.makeCall(artistId, other parameters such as page no,.....,function(data2){
  37. $scope.nextPage = $scope.nextPage + 1;
  38. if($scope.nextPage > data2.data.pagination.pages){
  39. $scope.morePages = false;
  40. }
  41. $scope.releases = $scope.releases.concat(data2.data.releases);
  42.  
  43. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement