Here's how I resolved the issue. All comments welcome.

// in the following directive, replace flag generates multidir error, so 
done manually
.directive('mwControlButton',['$compile',function($compile){
    return {
        restrict:'E',
        compile: function(tElement,tAttrs) {
            // defer compilation to link function
            var $content = 
$('<md-button>'+tElement[0].innerHTML+'</md-button>');
            tElement[0].innerHTML = '';
            // merge attributes from parent
            $content.attr('something','something'); // test
            // return link function
            return function(scope,element){
                // monitor memory leaks here for scope -- but so far does 
not appear to be problem
                var content = $compile($content)(scope);
                element.replaceWith(content); 
            }
        }
    }
}]);


On Sunday, March 29, 2015 at 1:58:01 AM UTC-4, Henrik Bechmann wrote:
>
> I want to change/replace the root element of the tElement passed in to the 
> directive compile function.
>
> (replace flag generates error, and in any case is deprecated). The effect 
> should be the same as setting the replace flag to true.
> function compile(tElement...
>    tElement.replaceWith('<new html>');
>
> has no effect.
>
> Is there some way of doing this?
>
> Thanks.
>

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