angular.module('notificationApp.footballController', []).
controller('footballController', function($scope, $http, $timeout) {


    $scope.getLeagueTable = function() {
        $http.get('http://api.football-data.org//v1/competitions/399/leagueTable')
            .then(function(response) {
                $scope.leagueTableData = angular.fromJson(response.data);
            });
    };
    $scope.getLeagueTable();

    $scope.getFixtures = function() {
        $http.get('http://api.football-data.org/v1/teams/81/fixtures')
            .then(function(response) {
                $scope.teamFixtures = angular.fromJson(response.data);
            });
    };
    $scope.getFixtures();


    // Function to replicate setInterval using $timeout service.
    $scope.intervalFunction = function() {
        $timeout(function() {
            $scope.getLeagueTable();
            $scope.intervalFunction();
        }, 43200000)// wait 12 hours between api queries
    };

    // Kick off the interval
    $scope.intervalFunction();


});

@@ -385,37 +385,8 @@
   %7D;
-%0A    $scope.getLeagueTable();
 %0A%0A  
@@ -629,35 +629,8 @@
  %7D;%0A
-    $scope.getFixtures();%0A%0A
 %0A   
@@ -747,33 +747,29 @@
    $
-timeout(function() %7B%0A    
+scope.getFixtures();%0A
     
@@ -793,24 +793,58 @@
 gueTable();%0A
+        $timeout(function() %7B%0A    
             
@@ -878,16 +878,20 @@
         
+    
 %7D, 43200
@@ -894,16 +894,17 @@
 3200000)
+ 
 // wait 

refactor footballController query structure