title: Require a directive's controller that is nested in a parent directive, AngularJS
body: <p>I'm wondering if there is a way to require the controller of a directive that exists/is nested somewhere as a common parent's child directive in AngularJS.</p>
  
  <h2>Directive Structure</h2>
  
  <p>Suppose I have the following structure for my directives:</p>
  
  <pre><code>&lt;parent-directive&gt;
      &lt;ul&gt;
          &lt;li some-nested-directive ng-repeat="dir in directives"&gt;&lt;/li&gt;
      &lt;/ul&gt;
      &lt;settings-menu&gt;&lt;/settings-menu&gt;
  &lt;/parent-directive&gt;
  </code></pre>
  
  <h2>Directive Definition</h2>
  
  <pre><code>/* 
  * some-nested-directive directive definition
  */
  .directive('someNestedDirective', function(){
      // ...
      return {
         restrict: 'A',
         controller: someNestedDirectiveController
      };
  });
  
  /* 
  * settings-menu directive definition
  */
  .directive('settingsMenu', function(){
      return {
          restrict: 'AE',
          require: [], // how to require the nested-directive controller here?
          link: function(scope, iElement, attrs, ctrls){
              // ...
          }
      };
  })
  </code></pre>
  
  <p>I've already checked out <em><a href="https://stackoverflow.com/questions/19340495/how-to-access-parent-directives-controller-by-requiring-it-recursively">this</a></em> SO question which states how to require controllers of directives that exist along the same line in a hierarchy.</p>
  
  <p>But my question is regarding <strong><em>a way to do the same in a hierarchy of directives that NOT necessarily exist along the same line</em></strong>. And if this is not possible, what is a proper workaround for it. Any help would be appreciated. </p>
  
  <p><strong><em>EDIT</em></strong></p>
  
  <p>Also, can any of the prefixes for <code>require</code> (or a combination of them) be used to achieve the same?</p>