Hi Ward,

You're right, there's no need for the transclude.  I guess since there's no 
template the dom isn't manipulated by angular and you're free to wrap it in 
the linking function.

My mistake and thanks for bringing it up.

On Thursday, February 6, 2014 6:51:41 PM UTC-5, Ward Bell wrote:
>
> Thank you both. Umi first for leading me to the explanation.
>
> As it happens, I don't think you need the transclude either. It's much 
> more obvious to just wrap the element which is all you're really doing 
> anyway with the more complex (and difficult to follow) transclusion 
> function.
>
> Here's a revised plunker that shows what I mean: 
> http://plnkr.co/edit/wp1J7hz2tFjKkJB48I7X?p=info
>
> It all boils down to this:
>
> app.directive('panel', function () {
>     return {
>         restrict: 'A',
>         replace: false,
>
>         link: function (scope, element, attrs, ctrl) {
>             var wrapper = angular.element('<span 
> class="transcluded"></span>')
>             element.wrap(wrapper);
>         }
>     };
> });
>
>
> Am I really missing anything by manipulating the HTML myself in this 
> fashion?
>

-- 
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/groups/opt_out.

Reply via email to