Ah, nice thought using terminal + $compile. I have to admit I dismissed
terminal early on knowing I wanted nested directives to run... thanks!


----------------------------------------------------------------
jrussell.me


On Wed, Apr 2, 2014 at 9:38 AM, Sander Elias <[email protected]> wrote:

> Hi Justin,
>
> Nice idea.
>
> try something like this:
>
> angular.module('dryDemo').directive('dryDemo', ['dryDemoBlocks','$compile',
>    function(dryDemoBlocks,$compile) {
>       'use strict';
>       return {
>          restrict: 'A',
>          priority: 5000,
>          terminal: true,
>          compile: function(element, attrs) {
>             var blockId = attrs.dryDemo;
>             console.log('drydemo', element[0].innerHTML);
>             dryDemoBlocks.set(blockId, element.html());
>
>             //Now that we retreived the original html, proceed with 
> compilation
>             //but skip directives with priority 5000 or above to avoid 
> infinite
>             //recursion (we don't want to compile ourselves again)
>             var compiled = $compile(element, null, 5000);
>
>             return function(scope, element, attrs) {
>                compiled(scope);
>             };
>          }
>       }
>    }
> ]);
>
> I think that will do!
>
> 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.
>

-- 
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