title: What is the equivalent of jQuery ajax beforeSend in Angularjs?
body: <p>I am familiar with <a href="http://api.jquery.com/jQuery.ajax/" rel="noreferrer"><strong>Jquery AJAX call</strong></a>, which has different callbacks like beforeSend, success, complete, etc.</p>
  
  <p>This is the example AJAX call with Jquery:</p>
  
  <pre><code>$.ajax({
    url: 'register.php',
    type: 'POST',
    data: {name:name, email:email},
    beforeSend: function() {
         // show loading GIF
    },
    complete: function() {
        // hide loading GIF
    },
    success: function(data) {
        // parse response
    }
  });
  </code></pre>
  
  <p>I want to achieve the same using AngularJS.</p>
  
  <p>Is there a callback like <strong>beforeSend</strong> for AngularJS AJAX request ?
  This is my code so far, but i am not sure where can i use a callback like <strong>beforeSend</strong> (so that i can display a loading GIF image) in my code:</p>
  
  <pre><code>$http.post('register.php', {'name': $scope.name, 'email': $scope.email})
  .success(function(data, status, headers, config) {
      if (data != '') { 
      }
  });
  </code></pre>