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

Chapter 7. Transclusion

Up to this point, we've primarily focused on one side of directives, which is how they can affect the elements to which they are attached by replacing the HTML via a template, binding additional plugins, or some combination of the two. In this chapter, we're going to look at the opposite side and see how transclusion allows for the original element's content to impact the behavior of the directive. While this methodology is certainly less common, it still is a powerful tool to be aware of and one you should call to mind when you find yourself tempted to create multiple directives that only vary from one another in content. With that, let's dive in and check out some examples.

That's not a word...

True. Looking up transclude ...

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