title: How to get all directive names in a given angular app?
body: <p>Say I have an angular app, that has some modules and some directives.<br>
  I want to get a list of all the defined directives in this app.</p>
  
  <p>For example:</p>
  
  <pre><code>var myModule = angular.module('myModule', [function(){...}]);
  myModule.directive('myDirective', [function () {...}]);
  myModule.directive('myOtherDirective', [function () {...}]);
  var myOtherModule = angular.module('myOtherModule', [function(){...}]);
  myOtherModule.directive('thirdDirective', [function () {...}]);
  </code></pre>
  
  <p>I want to write a function <code>getAllDirectives()</code> that will return <code>['myDirective','myOtherDirective','thirdDirective']</code>.<br></p>
  
  <p>Also if possible I would also like to know which module each directive belongs to:</p>
  
  <pre><code>{
      'myModule': ['myDirective','myOtherDirective'],
      'myOtherModule':['thirdDirective']
  }
  </code></pre>
  
  <p>How can this be done?<br>
  Please note that I need to do this from outside the app itself and after it has already loaded. I do have access to anything publicly available on the page, such as the <code>angular</code> object and the <code>DOM</code>.</p>