title: Angular JS: Service Response not Saving to Variable
body: <p>I'm trying to work out why the response of this service isn't saving to  <code>$scope.counter</code>. I've added a function to my service <code>fetchCustomers(p)</code> which takes some parameters and returns a number, which I'd like to save to <code>$scope.counter</code>.</p>
  
  <p><strong>service</strong></p>
  
  <pre><code>angular.module('app')
  .factory('MyService', MyService)
  
  function MyService($http) {
    var url = 'URL'';
  
    return {
      fetchTotal: function(p) {
        return $http.get(url, { params: p })
          .then(function(response) {
            return response.data.meta.total;
          }, function(error) {
            console.log("error occured");
          })
      }
    }
  }
  </code></pre>
  
  <p><strong>controller</strong></p>
  
  <pre><code>$scope.counter = MyService.fetchTotal(params).then(function(response) {
    console.log(response);
    return response;
  });
  </code></pre>
  
  <p>For some reason though, this isn't working. It's console logging the value, but not saving it to <code>$scope.counter</code>. Any ideas?</p>