O'Reilly logo

AngularJS Directives by Alex Vanston

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Summary

As you can see, once we've grabbed $transclude, the rest of the manipulations are actually quite standard. In this case, because we've distributed the transcluded content in a piecemeal manner, we end up not even ever inserting the clone element itself back into the DOM; however there might be other times when you only want to extract part of the element for use elsewhere, and then insert the rest back into its normal location. In either case, always remember that transclusion is your friend when you need to interact with the content internal to your directive. Use the standard ng-transclude directive when you want the content unaltered, and controller plus $transclude if you need to manipulate it first. Coming up next we're going to spend ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required