Introduce two important features to the DOM compiler: the ability to include parts of the one template in another (regular transclusion) and the ability to easily control when and how may copies of a given element are linked and attached (full element transclusion).
Issue Checklist
[ ] How transclusion causes the contents of an element to be removed from the DOM, separately compiled, and made available to link and attach later using the transclusion function.
[ ] That the transclusion function is really just a public link function, wrapped inside a couple of other functions.
[ ] That the transclusion function is available to all directives on the element, not just the one that asked for transclusion. Even when there is no transclusion directive on an element, the transclusion function of the nearest transcluding parent is received.
[ ] That only one transclusion directive is allowed per element.
[ ] That by default, transcluded contents are linked using a special transclusion scope, that prototypally inherits from the surrounding scope so that it has the correct data, but whose parent is based on where the transclusion function is called, so that the lifecycle is correct.
[ ] That when a directive author calls the transclusion function, they can choose to provide their own scope in which case the default transclusion scope is not constructed.
[ ] That the public link function has an “options” argument, through which arguments like parentBoundTranscludeFunction and transcludeControllers can be passed. While they are mostly used internally by the transclusion system, they can be used when calling the public link function in other contexts.
[ ] That the transclusion function is available to directive controllers through the $transclude injection, and that it is the exact same function given to directive link functions as the fifth argument.
[ ] That the public link function can receive a “clone attach function” that causes a clone of the original DOM to be linked instead of the original DOM itself. This is useful when, for example, you want to link several copies of a DOM that was previously compiled once.
[ ] That you can also pass the clone attach function to the transclude function.
[ ] That when you pass a clone attach function, it will be called with the transcluded DOM and scope. Also, it will be called before linking occurs so that you can manipulate the DOM and the scope just before they are linked.
[ ] How transclusion is supported by the asynchronous template loading triggered by templateUrl.
[ ] How transclusion is (kind of) supported by multi–element directives.
[ ] How the ngTransclude directive works – by simply making the core transclusion features available through a simple declarative interface.
[ ] How full element transclusion has a similar implementation as regular transclusion, but that it is meant for a completely different purpose.
[ ] That full element transclusion causes the original element to be replaced with a comment, and the original element with its children to be available through the transclusion function.
[ ] That the public compile function takes a maxPriority argument, used by full element transclusion, but available for other potential use cases as well.
[ ] How controller requiring is enabled for element transclusion.
Description
Introduce two important features to the DOM compiler: the ability to include parts of the one template in another (regular transclusion) and the ability to easily control when and how may copies of a given element are linked and attached (full element transclusion).
Issue Checklist
parent
is based on where the transclusion function is called, so that the lifecycle is correct.parentBoundTranscludeFunction
andtranscludeControllers
can be passed. While they are mostly used internally by the transclusion system, they can be used when calling the public link function in other contexts.$transclude
injection, and that it is the exact same function given to directive link functions as the fifth argument.templateUrl
.ngTransclude
directive works – by simply making the core transclusion features available through a simple declarative interface.maxPriority
argument, used by full element transclusion, but available for other potential use cases as well.All issues in milestone: 0.6.0 milestone
Assignees