title: Defer processing of directive in AngularJs
body: <p>I have the need to defer the processing of a directive nested inside another one until an asynchronous operation is performed by the nesting directive. This is easily done with two lines of JQuery, but I was wondering if there was a purely Angular way to do the same, maybe using $q. </p>
  
  <p>In <a href="http://jsfiddle.net/4smtgs3f/1/" rel="nofollow">http://jsfiddle.net/4smtgs3f/1/</a> you can find an example of what I mean: </p>
  
  <pre><code>&lt;div ng-controller="MyCtrl"&gt;
      &lt;loadData url="http://ip.jsontest.com/"&gt;
          &lt;transformAndOutput/&gt;
      &lt;/loadData&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>loadData is loading data from some URI, while one or more transformers handle the processing and display of the data. BTW, in the JSFiddle I use two different loadData directives: loadData1 uses <i>$http</i> asynchronously and fails to load the data in time, while loadData2 uses JQuery <i>$.ajax</i> synchronously and works very well. </p>
  
  <p>So the problem is: <i>$http</i> only works asynchronously, and the inner directive is processed <b>before</b> the asynchronous loading operation has completed. Is there an angular way to obtain the same result?</p>
  
  <p>I know that it is possible to defer the execution of a user-defined function, using then or $q or something, but can I defer the processing of a directive? How would I do? </p>
  
  <p>Thanks for all you can do. </p>
  
  <p>FV</p>