0

I am trying to retrieve data from this API using angular, but I'm not sure what I'm doing wrong. I followed this tutorial and adapted it but not working.

http://www.toptal.com/angular-js/a-step-by-step-guide-to-your-first-angularjs-app

This is the JSON I am using:

http://www.football-data.org/fixtures

I set up a plunker so you can see the code:

http://plnkr.co/edit/H1bm1oaeBv3xE4sBL82U

angular.module('FootballFixturesApp.services', []).
  factory('footballdataAPIservice', function($http) {

    var footballdataAPI = {};

    footballdataAPI.getFixtures = function() {
      return $http({
        method: 'JSONP', 
        url: 'http://www.football-data.org/fixtures'
      });
    }

    return footballdataAPI;
  });
user1937021
  • 10,151
  • 22
  • 81
  • 143
  • Any errors you see inside developer tools ? – themyth92 Jan 19 '15 at 03:58
  • Your `http://www.football-data.org/fixtures` does not allow `Access-Control-Allow-Origin` as well as using `JSONP` and putting `callback` query parameter. You can try change your `url` into the `url` ( http://ergast.com/api/f1/2013/driverStandings.json?callback=JSON_CALLBACK) like what they are using inside the tutorial and I think it will work. About the `Access-Control-Allow-Origin` and `JSONP` allowance you have no control on that. – themyth92 Jan 19 '15 at 04:08

0 Answers0