Thanks, Sander.  I'm not sure how I can move the helper to the compile 
phase.  Note that it is trying to create new scopes each time it is invoked 
recursively.  So, the helper seems to need to do linking. I'm going down 
this path because I couldn't get the first approach to work (see the first 
post in this thread).  The problem was that as the directive recursed via 
the transclude, the foo() method was called in the directive scope, not the 
parent containing scope.  

Pretty much what I am trying to do is to make a directive walk a tree. 
 I've made this work fine without a directive, using ng-include:

<nav class="menu">
  <div ng-repeat="area in lutronAreas.areas" 
ng-include="'partials/rooms-nav-area.html'"></div>
</nav>


And the include:


<div>
  <ul>
    <li><a ng-click="setArea(area)">{{area.name}}</a></li>
    <div ng-repeat="area in area.areas" 
ng-include="'partials/rooms-nav-area.html'"></div>
  </ul>
</div>


This code walks the tree just fine - and the ng-click method setArea is called 
from the parent scope, of course.  I'm trying to create a general purpose 
directive that walks the

the tree and inserts some html.



On Tuesday, December 9, 2014 1:40:37 AM UTC-5, Sander Elias wrote:
>
> Hi Siegeld,
>
> I can solve it for you, but you are on the right track, I think you will 
> learn more if you do it yourself.
> Your helper function should be in the compile fase, have a look at the 
> documentation 
> on the compile property of the ddo 
> <https://docs.angularjs.org/api/ng/service/$compile>
>
> Don't hesitate to ask if you have some more questions!
>
> Regards
> Sander
>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to