title: Make an http request on a service, get response in controller
body: <p>I'm making an http request for a local JSON file using a Service. I'm trying to store the data from the successful HTTP request in my controller but that part is not working. The http request does however seem to be successful on the Service.</p>
  
  <pre><code>var myModule = angular.module("MyApp", [])
  
    .controller('MyController', function(Utilities){
  
       //this is not working
       self.socialArr = Utilities.getData("data.json");
  
     }).service('Utilities', function($http) {
  
       var self = this;
  
       self.getData = function(jsonData) {
         $http.get(jsonData)
          .then(function(response) {
              //First function handles success
              var theData = response.data;
              console.log(theData); //this works (data is logged)
              return theData;
          }, function(response) {
              //Second function handles error
              console.log("Error loading JSON data");
          });
       };
   });
  </code></pre>