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;
  });
2
  • Any errors you see inside developer tools ? Commented Jan 19, 2015 at 3: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 ( ergast.com/api/f1/2013/…) 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. Commented Jan 19, 2015 at 4:08

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.