title: angular async upload file with promises
body: <p>I'm new to angular, and i'm little bit confused via doc's from official site...</p>
  
  <p>I have controller, there i have call of service method:</p>
  
  <pre><code>uploaderService.addImage(files);
  </code></pre>
  
  <p>and such service:</p>
  
  <pre><code>.service('uploaderService', ['$http', 'settings', function ($http, settings) {
  
      var url = undefined;
  
      var addImage = function(files){
        var fd = new FormData();
        fd.append("file", files[0]);
        $http.post(settings.apiBaseUri + "/files", fd, 
          {
            withCredentials: true,
            headers: {'Content-Type': undefined },
            transformRequest: angular.identity
          })
          .success(function (data, status, headers, config) {         
              url = "temp.jpg";
          })
          .error(function (err, status) {
            console.log('operation failed, status: ' + status);
          });
      };
  
      var deleteImage = function(){      
      };   
  
      return {
        addImage: addImage,
        deleteImage: deleteImage
      }; 
  </code></pre>
  
  <p>how could i wait until post data request if finished, and then pass in url variable location? i try so and so, but something gonna bad, and need help)</p>