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

Manipulating the transcluded content

Sometimes you want more control over the transcluded content than just dropping it into an element and calling it a day. There are a couple of different methods you can use, but I've found the most efficient and straightforward is by utilizing the directive controller. As you likely remember from the previous chapter, one of the main benefits of controllers is that they can be shared across directives. Another feature, not as commonly used, is that they can also require $transclude, which provides a transclusion function already properly bound to the parent scope and ready for use.

Again, you'll really only need to utilize this functionality when you want to manipulate the transcluded content before including ...

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