Transcluding Elements
Transcluding can be kind of a difficult concept to pick up on at first. Basically, the idea is that you can keep the contents of the custom directive defined in an AngularJS template and bind them to the scope. The way this works is that the linking function for the directive receives a transclusion function that is prebound to the current scope. Then elements inside the directive have access to the scope outside the directive.
You can set the transclude option to the following values:
■ true: Transcludes the content of the directive.
■ 'element': Transcludes the whole element, including any directives defined at lower priorities.
You must also include the ngTransclude directive in elements inside your directive template. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access