title: Get Data from AngularJS HTTP post call in controller from factory
body: <p>I'm posting data to a a Python API and the API response returns data that I want to use in a controller and eventually in one in HTML partial associated with that view. I'm able to successfully get the data as i'm logging the response.data from the call but when I call the method from my controler, I get an error stating cannot read property of "then" undefined.</p>
  
  <pre><code> function getCustomerGraphData(payload, config) {
  
          var data = {
              user_selection: JSON.stringify(payload),
              index_info: JSON.stringify(config.index_info),
              column_config: JSON.stringify(config.Results)
          };
  
          console.log("data", data);
  
          $http({
              url: 'URL',
              method: "POST",
              data: $.param(data),
              headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
          }).then(function(response) {
              var customer = response.data;
  
              console.log("data", customer);
  
              return customer;
          });
  
      }
  </code></pre>
  
  <p>Service</p>
  
  <pre><code> arisService.getCustomerGraphData()
          .then(function(data){
              $scope.overIndexData = data;
          })
  </code></pre>
  
  <p>Controller</p>