title: How do I pass any array from ng-repeat to AngularJs attribute directive?
body: <p>I have a list of hierarchy of menu items where each item has a child list. For The menuItems property is from the controller scope(list of parents). I want to pass an array to be consumed by the directive on both levels of the following example.</p>
  
  <p>Html Code</p>
  
  <pre><code>&lt;div sortable="menuItems"&gt;
      &lt;div ng-repeat="item in menuItems"&gt;
          ...
          &lt;div sortable="item.Children"&gt;
              &lt;div ng-repeat="child in menuItems.Children"&gt;...&lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Directive code </p>
  
  <pre><code>app.directive('sortable', function ($timeout) {
      return {
          restrict: 'A',
          link: function($scope, $elem, attrs) {
           // I need access by the array in here.
          }
      };
  });
  </code></pre>
  
  <p>I have set the sortable attribute to the value of the name of the list which obviously is not working for me.</p>