0

Code:

When i past the url in the browser i can see all the objects when i try to it out on for example : link

but I don't seem it to get it working in my code am i missing anything ?

 angular.module('ionicApp', ['ionic'])

 .controller('MyCtrl', function($scope, $http) {

  $scope.items = [];



  $http.jsonp('cmaden.pythonanywhere.com/api/v1/today/?format=jsonp').success(function    (data) {
    $scope.items = data;

});

});
CMP
  • 435
  • 3
  • 8
  • 22

1 Answers1

1

Add "https://" to the front of the url. You will also need a callback. Please see the example below.

angular.module('ionicApp', ['ionic'])
 .controller('MyCtrl', function($scope, $http) {
 window.callback = function(data) {
      $scope.items = data
    }  
  $scope.items = [];
 $http.jsonp('https://cmaden.pythonanywhere.com/api/v1/today/?format=jsonp');  
});
Onosa
  • 1,275
  • 1
  • 12
  • 28