title: Use $q to execute a function AFTER a few other functions have been executed?
body: <p>All of the tutorials about <code>$q.all()</code> that I can find involved creating <code>$q.defer()</code>s and passing them to an array of <code>promises</code> and then calling <code>$q.all(promies)</code></p>
  
  <p>My question is, what if I wanted a function to execute after some other functions were executed and resolved? For example, I want <code>D</code> to run after <code>A</code>, <code>B</code>, and <code>C</code> run? </p>
  
  <p>But the key thing is, they are separate functions and not in the same block</p>
  
  <p>For example:</p>
  
  <pre><code>var func1 = function(){
       var deferred = $q.defer();
       // do stuff
       if (successful){
           deferred.resolve("success");
       return deferred;
  }
  var func2 = function(){
       var deferred = $q.defer();
       // do stuff
       if (successful){
           deferred.resolve("success");
       return deferred;
  }
  var func3 = function(){
       var deferred = $q.defer();
       // do stuff
       if (successful){
           deferred.resolve("success");
       return deferred;
  }
  
      var theMainFunction = function(){
          var promises = [];
          promises.push(func1);
          promises.push(func2);
          promises.push(func3);
          $q.all(promises).then(function(){
            //do cool stuff
          });
  }
  </code></pre>
  
  <p>How can I get this to work?</p>