In the angular documentation for the compile service (starting at line 412) there is a description of the transclude function that is passed into the linking function of a directive.
The relevant part reads:
function([scope], cloneLinkingFn, futureParentElement)
In which (line 212):
futureParentElement
: defines the parent to which thecloneLinkingFn
will add the cloned elements.
default:
$element.parent()
resp.$element
fortransclude:'element'
resp.transclude:true
.only needed for transcludes that are allowed to contain non html elements (e.g. SVG elements) and when the
cloneLinkinFn
is passed, as those elements need to created and cloned in a special way when they are defined outside their usual containers (e.g. like<svg>
).See also the
directive.templateNamespace
property.
I fail to see the point of futureParentElement
however. It says
defines the parent to which the cloneLinkingFn will add the cloned elements.
But you do that in the cloneLinkingFn
itself like this:
transclude(scope, function (clone) {
some_element.append(clone);
});
And you can't use the transclude function without defining the cloning function in the first place.
What is the proper usage/a use for futureParentElement
?