From 293aa692926254a8172f7e422fed6e1cf54576bf Mon Sep 17 00:00:00 2001 From: Daniel Tabuenca Date: Fri, 13 Dec 2013 15:20:31 -0800 Subject: [PATCH] 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. This commit removes the controller and simplifies ngTransclude. --- src/ng/directive/ngTransclude.js | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/src/ng/directive/ngTransclude.js b/src/ng/directive/ngTransclude.js index 295e47a9922c..86b5ff6100b4 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); });