How to delay promise execute after defer is resolve
<p>I used angular <code>$q</code> to create a defer object like this:</p>

<pre><code>var defer = $q.defer();
var promise = defer.promise;

setTimeout(function(defer){
    defer.resolve("nothing");
},2000,defer);

promise.then(function(){
    //code here
});
</code></pre>

<p>So the code in promise will delay 2 seconds, but <strong>I want to know how to delay code execution after defer is resolved</strong>, so that I can delay code execution like this:</p>

<pre><code>promise.delay(1000);
</code></pre>

<p>when I get a promise from $http.post()</p>

<pre><code>var promise = $http.post()...;
promise.then(function(){
     // code 
});
</code></pre>

<p>how to delay that code execute , since promise is resolved.</p>