That's exactly what I needed to know! 

Thanks so much taking the time to layout a code example and even explain it.

Very much appreciated!
Mike

On Wednesday, August 20, 2014 1:07:04 AM UTC-4, Sander Elias wrote:
>
> Hi Michael,
>
> yes, you can do that, but if you need the stuff you add/manipulate to be 
> compiled too. (say you add an another angular directive…) you need to
> recompile the element. or at least the parts you modified.
>
> here is an example of that:
>
> .directive('testModel', function($compile) {
>   return {
>     restrict: 'A',
>     priority: 9999,
>     terminal: true,
>     compile: function(el, attr) {
>        attr.$set('ngModel',attrs.testModel);
>
>        var resumeCompilation = $compile(el, null, 9999);
>        return function(scope) {       
>          // make sure the right scope is linked to the template!
>          resumeCompilation(scope);
>        };
>     }
>   };
> });
>
> It works by pausing the compilation. The terminal:true combined with the 
> high priority makes sure this directive comes first, and does not compile 
> the other attached stuff.
> then it manipulates the template/HTML. You can use any technique you like 
> to do that, not just the attr.$set.
> When done with your manipulation, the compile will pick up where we left 
> off, and starts compiling the remaining parts.
>
> Is this enough to get you going?
>
> 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