I'm currently attempting to retrieve JSON data from a certain URL and am having trouble getting it to work. Despite going through the Angular documentation and other resources, I still can't pinpoint the issue due to my limited experience with Angular. Can anyone provide some assistance, please?
Here is my code:
var app = angular.module('mainApp', []);
app.controller('mainController', ['$http', function ($http){
var self = this;
this.matches = [];
console.log(this.matches);
this.baseUrl = "https://raw.githubusercontent.com/openfootball/football.json/master/2015-16/en.1.json";
this.loadAllMatches = function(){
$http({
method: "GET",
url: self.baseUrl,
}).then(function successCallback(response){
console.log(response);
self.matches = response.data.matches;
console.log(self.matches);
},function errorCallback(response){
alert("Some Error occurred, check the console");
console.log(response);
});
}
}]);