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

...it is a solution

For Angular that answer is transclusion. My unofficial interpretation of the word is translated-inclusion. What transclusion does is offer a way to create a widget with an isolate scope, which we as good modular developers always do, but then tunnel back out into the parent scope to parse the original content. This, of course, is significantly clearer in an example, so let's check one out. Take a look at the following HTML and note what's different from our previous examples:

<div> <input type="text" ng-model="name" /> <select ng-model="movie"> <option value="Man Of Steel">Superman</option> <option value="A New Hope">Star Wars</option> </select> <input type="number" ng-model="friendCount" /> </div> <div movie-info="movie"> <p>Hi, ...

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