aboutsummaryrefslogtreecommitdiffstats
path: root/src/ng/directive/ngTransclude.js
diff options
context:
space:
mode:
authorDaniel Tabuenca2013-12-13 15:20:31 -0800
committerCaitlin Potter2014-02-11 14:57:56 -0500
commit08793a690abe3eda40deae10f8a0a117779bdbd9 (patch)
tree615f5b6d94f44b056ea113a1e5d906d2af88153f /src/ng/directive/ngTransclude.js
parentef4bf8c77cf0c1cd1276b6cee2fd48317d3902b5 (diff)
downloadangular.js-08793a690abe3eda40deae10f8a0a117779bdbd9.tar.bz2
refactor(ngTransclude): use transclusion function passed in to link
Since we now pass in the transclusion function directly to the link function, we no longer need the old scheme whereby we saved the transclude function injected into the controller for later use in during linking. Additionally, this change may aid in correcting a memory leak of detached DOM nodes (see #6181 for details). This commit removes the controller and simplifies ngTransclude. Closes #5375 Closes #6181
Diffstat (limited to 'src/ng/directive/ngTransclude.js')
-rw-r--r--src/ng/directive/ngTransclude.js21
1 files changed, 7 insertions, 14 deletions
diff --git a/src/ng/directive/ngTransclude.js b/src/ng/directive/ngTransclude.js
index 295e47a9..86b5ff61 100644
--- a/src/ng/directive/ngTransclude.js
+++ b/src/ng/directive/ngTransclude.js
@@ -56,23 +56,16 @@
*
*/
var ngTranscludeDirective = ngDirective({
- controller: ['$element', '$transclude', function($element, $transclude) {
+ link: function($scope, $element, $attrs, controller, $transclude) {
if (!$transclude) {
throw minErr('ngTransclude')('orphan',
- 'Illegal use of ngTransclude directive in the template! ' +
- 'No parent directive that requires a transclusion found. ' +
- 'Element: {0}',
- startingTag($element));
+ 'Illegal use of ngTransclude directive in the template! ' +
+ 'No parent directive that requires a transclusion found. ' +
+ 'Element: {0}',
+ startingTag($element));
}
-
- // remember the transclusion fn but call it during linking so that we don't process transclusion before directives on
- // the parent element even when the transclusion replaces the current element. (we can't use priority here because
- // that applies only to compile fns and not controllers
- this.$transclude = $transclude;
- }],
-
- link: function($scope, $element, $attrs, controller) {
- controller.$transclude(function(clone) {
+
+ $transclude(function(clone) {
$element.empty();
$element.append(clone);
});