Hi, Thanks a lot. Regarding the first issue - what happens to the menuCtrlr once I route to a new url? Would the route function handle only the viewCtrlr and leave menuCtrlr as is? About the second issue, your code helps me with other matters :) My problem is that my directive loads a third party module (e.g google earth), which I do not need to compile - I just load it into the DOM. My problem is that every time I route to a new page, it reloads the map.
On Monday, April 7, 2014 6:23:53 PM UTC+3, Sander Elias wrote: > > Hi, > > >> 1. Do you mean "nested controllers"? Like <div >> ng-controller="menuCtrlr"><div ng-controller="viewCtrlr"></div</div> >> >> Yes, that is what I mean. > > >> 1. I've found your answer regarding $formatter ( >> >> https://groups.google.com/forum/#!searchin/angular/Sander%7Csort:date/angular/ikEnKkoAUF8/qt21aRgu8iAJ) >> >> but could not make the connection to my case with that. Is this the one? >> :) >> >> Yes this is the example. > > have a look at this: > > app.directive('myDirective', function ($compile, $timeout) { > return { > restrict: 'A', > priority: 2000, > terminal: true, > replace: false, > compile: function(element, attrs) { > // do the directive modification stuff here > > //one time compilation in compile function > // this will only run on first time use. > var compiled = $compile(element,null,2000); > > return function(scope, element, attrs, ctrl){ > //in the link function, use the previously created compile function to > // hook up the scope to the precompiled template > compiled(scope); > } > } > }; > }); > > does that help? > 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.
