Advertisement
Guest User

Untitled

a guest
Apr 19th, 2014
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.12 KB | None | 0 0
  1. <a href="{{item.url}}" class="item item-avatar" ng-repeat="item in restocks | reverse" ng-if="!$first">
  2. <img src="https://lukemil.es/sup-images/mobile/{{item.id}}.jpg">
  3. <h2>{{item.name}}</h2>
  4. <p>{{item.colors}}</p>
  5. </a>
  6. </div>
  7.  
  8. angular.module('restocks', ['ionic'])
  9. .service('restockAPIservice', function($http) {
  10.  
  11. var restockAPI = {};
  12.  
  13. restockAPI.getRestocks = function() {
  14. return $http({
  15. method: 'GET',
  16. url: 'https://myurl/api/restocks.php'
  17. });
  18. }
  19.  
  20. return restockAPI;
  21. })
  22.  
  23. .filter('reverse', function() {
  24. //converts json to JS array and reverses it
  25. return function(input) {
  26. var out = [];
  27. for(i in input){
  28. out.push(input[i]);
  29. }
  30. return out.reverse();
  31. }
  32. })
  33.  
  34. .controller('itemController', function($scope, restockAPIservice) {
  35. $scope.restocks = [];
  36. $scope.sortorder = 'time';
  37.  
  38. $scope.doRefresh = function() {
  39. $('#refresh').removeClass('ion-refresh');
  40. $('#refresh').addClass('ion-refreshing');
  41. restockAPIservice.getRestocks().success(function (response) {
  42. //Dig into the responde to get the relevant data
  43. $scope.restocks = response;
  44. $('#refresh').removeClass('ion-refreshing');
  45. $('#refresh').addClass('ion-refresh');
  46. });
  47. }
  48.  
  49. $scope.doRefresh();
  50.  
  51. });
  52.  
  53. TypeError: Cannot call method 'querySelectorAll' of undefined
  54. at cancelChildAnimations (http://localhost:8000/js/ionic.bundle.js:29151:22)
  55. at Object.leave (http://localhost:8000/js/ionic.bundle.js:28716:11)
  56. at ngRepeatAction (http://localhost:8000/js/ionic.bundle.js:26873:24)
  57. at Object.$watchCollectionAction [as fn] (http://localhost:8000/js/ionic.bundle.js:19197:11)
  58. at Scope.$digest (http://localhost:8000/js/ionic.bundle.js:19300:29)
  59. at Scope.$apply (http://localhost:8000/js/ionic.bundle.js:19553:24)
  60. at done (http://localhost:8000/js/ionic.bundle.js:15311:45)
  61. at completeRequest (http://localhost:8000/js/ionic.bundle.js:15512:7)
  62. at XMLHttpRequest.xhr.onreadystatechange (http://localhost:8000/js/ionic.bundle.js:15455:11) ionic.bundle.js:16905
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement